• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help with linked lists

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:)
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch
 
reply
    Bookmark Topic Watch Topic
  • New Topic