• 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

Understanding the addRange()

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


In the specified code above i am unable to understand the addRange() method functionality defined for each collection may help on the same.

Thanks
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you explain in more detail what exactly you don't understand?

Do you understand the for-loop in line 23? Do you know what the different kinds of collections are and how they work (HashSet, ArrayList, TreeSet, LinkedList)?
 
Jdinesh Tiwari
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Jesper de Jong

Thanks for your kind consideration on the issue
Yes, i am aware the the collections and for loop specified in the program
problem statement that i am unable to understand in the program how and what exactly these statements are performaing


addRange(set1, 1);

addRange(list1, 2);

addRange(set2, 3);

addRange(list2, 5);

static void addRange(Collection<Integer> col, int step)


 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Those first four lines are calls to the method named addRange, where the method is called with two arguments: a collection of Integer objects and an int.

See Defining Methods and Passing Information to a Method or a Constructor in Oracle's Java Tutorials.
 
reply
    Bookmark Topic Watch Topic
  • New Topic