Message from @Paragram Slide - AZ

Discord ID: 495338639429992479


2018-09-28 20:50:17 UTC  

```java
public static void testAddLast() { //passed
System.out.println("------------------testAddLast()----");
init();
list3.add("A");
System.out.println(list3);
list3.add("B");
System.out.println(list3);
list3.add(null);
System.out.println(list3);
list3.add("C");
System.out.println(list3);
drawLine();
}
```

2018-09-28 20:51:10 UTC  

```java
//Add the object e to the end of this list.
// it returns true, after e is successfully added.
public boolean add(Object e) {
ListNode newNode = new ListNode(e);
newNode.next = null;
get(this.size - 1).next = newNode;
this.size++;
return true;
}
```

2018-09-28 20:51:17 UTC  

any glaring problems here?

2018-09-28 20:51:55 UTC  

that get() could return null

2018-09-28 20:52:16 UTC  

hmmm

2018-09-28 20:52:22 UTC  

any ideas on how to fix that?

2018-09-28 20:52:39 UTC  

after init()

2018-09-28 20:52:53 UTC  

how many nodes in list3

2018-09-28 20:53:04 UTC  

println after init()

2018-09-28 20:53:19 UTC  

4

2018-09-28 20:53:33 UTC  

what is size

2018-09-28 20:53:42 UTC  

should be 4

2018-09-28 20:55:09 UTC  

I see

2018-09-28 20:55:24 UTC  

list3.add("C") will throw

2018-09-28 20:55:51 UTC  

because last node was null

2018-09-28 20:56:27 UTC  

and when you get it... and attempt to set next

2018-09-28 20:56:34 UTC  

the data was null, not the node itself I think

2018-09-28 20:56:43 UTC  

ahh ok

2018-09-28 20:56:53 UTC  

it must be the size then

2018-09-28 20:57:11 UTC  

get(this.size - 1) is returning null

2018-09-28 20:58:54 UTC  

```
ListNode last = get(this.size - 1);
if (last != null) {
last.next = newNode;
++this.size;
return true;
}
return false;
```

2018-09-28 20:59:42 UTC  

thanks

2018-09-28 21:02:13 UTC  

this would only happen adding first node to list I would think

2018-09-28 21:02:18 UTC  

what is this class?

2018-09-28 21:02:22 UTC  

data structures?

2018-09-28 21:02:27 UTC  

or Java class?

2018-09-28 21:03:39 UTC  

Data Structures

2018-09-28 21:04:23 UTC  

I actually have a Java developer certificate but it was a long time ago so I have to relearn everything

2018-09-28 21:04:36 UTC  

Got it same time as I graduated high school

2018-09-28 21:04:38 UTC  

when I took that class we used C

2018-09-28 21:04:56 UTC  

1999 😉

2018-09-28 21:05:47 UTC  

Java was its own class back then - the OOP class

2018-09-28 21:13:02 UTC  

I had to take a 3 part Java series to get into this class

2018-09-28 21:13:10 UTC  

It was part of my certificate

2018-09-28 21:24:09 UTC  

nice

2018-09-28 21:24:20 UTC  

it's a good line of work

2018-10-01 19:56:08 UTC  

I need help factoring a math problem @here

2018-10-01 19:56:30 UTC  

-x^2 + 5x + 14

2018-10-01 19:57:20 UTC  

(-x - 2)(x - 7)

2018-10-01 19:57:37 UTC  

I have meeting in 3 mins

2018-10-01 19:57:47 UTC  

but that is close