Like an ItemSet, is an ArrayList of itemInfo objects, you can skip them like this:
for(itemInfo info : itemSet){ System.out.println(info.actionID); System.out.println(info.auctionPrice); System.out.println(info.buyoutPrice); }
This will print them out completely. Perhaps, as you include the identifier, you can ask the user to enter the next identifier, and then you can extract it from the arraylist. You can do this by going through them all and comparing their ID with the ID entered by the user. For instance:
// get the ID int auctionId = scanner.nextInt(); itemInfo selectedInfo; // find that item for(itemInfo info : itemSet){ if(info.auctionId = auctionId){ selectedInfo = info; break; } } if(selectedInfo == null){ // the ID was not valid! // do something to handle this case. } else { System.out.println(selectedInfo.auctionID); System.out.println(selectedInfo.auctionPrice); System.out.println(selectedInfo.buyoutPrice); }
As you learn, here are a few things to make your code a little nicer:
1- Class names must begin with capital letters, you must change itemInfo as ItemInfo.
2- Usually you should use getters and setters, so instead of selectedInfo.auctionID you should use selectedInfo.getAuctionId() and selectedInfo.setAuctionId(x);
3. You should probably use a switch, not if (scanner.next (). Equals ("1")). Also, if you finish writing else if (scanner.next (). Equals ("2")), you will run into a problem, because every time scanner.next () is called, it expects input, so it was expecting would be input for each if. Instead, you should have scanner.next () outside your switch, and then use the value that is read. For instance:
int menuSelection = scanner.nextInt(); switch(menuSelection){ case 1: // do your stuff break; case 2: // do something else break; default: // handle any input which isn't a menu option }
4- Finally, you should probably separate the functionality for handling each of these menu options to separate methods. If you put all this into this method, it will be very fast and ugly (hard to maintain) very fast.