jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes LinkedList insert, remove and change Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "LinkedList insert, remove and change" Watch "LinkedList insert, remove and change" New topic

LinkedList insert, remove and change

Alexie Chong

Joined: Sep 16, 2011
Posts: 3
Dear Experts,

I am new to the LinkedList concept and trying out coding a LinkedList problem which require me to do Insert newInteger based on the Index, Remove Index and Change oldInteger to newInteger based on Index.
Please kindly advice what i should code in my

Sample input

4 8
1 5 2 3
I 1 2
R 2
C 1 10
I 4 2

Sample output


Here is my full code:

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15081

Before writing any code, you need to understand what a linked list is and how it works, and what your three methods are supposed to do exactly. Once you understand exactly what needs to be done, you can start thinking about writing code.

So, do you understand how a linked list works? If not, then what about it don't you understand exactly?

Can you describe in English what you think should be done in the insert, remove and change methods?

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46337
And you need to check about equality. Don't use == for reference types (unless they are enum members), but at least the compiler will notice you are using = by mistake.
I agree. Here's the link: http://aspose.com/file-tools
subject: LinkedList insert, remove and change
It's not a secret anymore!