• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with linked lists  RSS feed

 
Nikolas Spendik
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,

I am having a little trouble with a part of my Java assignment that needs to have linked lists in it.

I need help to write a public method that takes an array of type object to load strings into a linked list.

Any help is appreciated
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nikolas Spendik wrote:I need help to write a public method that takes an array of type object to load strings into a linked list.

Where are you stuck ?
Do you know how to create a method ? make it public ? specify a type and name for its parameters ?
If you don't know how to do any of those then you need to start here. Otherwise show us what you have got so far and where you are stuck.

By the way, if your method is supposed to add Strings to the linked list, it is better to pass an array of type String rather than an array of type Object.
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

As Joanne said, did your instructions really say to use an Object[] to put Strings into your List?
Are you supposed to create your own linked list class or use that available ready‑made?
 
Bhaskar Kumar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know about , if no, here discos in brief :

Linked List:-

uses doubly linked list to store the elements. It extends the AbstractList class and implements List and Deque interfaces.
can contain duplicate elements.
maintains insertion order.
not synchronized.
No random access.
manipulation fast because no shifting needs to be occured.
can be used as list, stack or queue.
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!