Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sorting arraylists in java
#1
I'm trying to create a method that sorts out a certain attribute of an object in an arraylist and print out the objects containing this attribute. Anyone know of a way to do this?
Reply
#2
for each object in arraylist {
if object has attribute{
print object

So basically you're using a loop to iterate through each element in the array, and printing it if it has the attribute. Does that help at all?
(2016-04-09 18:31:49)dotime Wrote: clam down
Reply




Users browsing this thread: 1 Guest(s)