Hey guys, i just wanted to know the codes for ArrayList class methods such as .clear() .add() .size() .isEmpty() etc... Your help will be appreciated!
Recommended Answers
Jump to PostAre you trying to implement an ArrayList or use the existing library code?
If it's the latter, the "codes" would beArrayList<Type> list = new ArrayList<Type>();
list.add(item); boolean b = list.isEmpty(); list.clear(); b = list.isEmpty();
Jump to PostBest way would be to try to write them. The code (mass noun, there is no "codes") is not publicly available as far as I know, but it's not too hard to work out how you'd implement these. You'll learn a lot more by writing than be reading, even if …
All 8 Replies
jon.kiparsky
326
Posting Virtuoso
terexberd
1
Newbie Poster
jon.kiparsky
326
Posting Virtuoso
JamesCherrill
4,571
Most Valuable Poster
Moderator
Featured Poster
terexberd
1
Newbie Poster
JamesCherrill
4,571
Most Valuable Poster
Moderator
Featured Poster
mKorbel
274
Veteran Poster
terexberd
1
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.