Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void removeBid(String name) {
- for(int a = 0;a < bidIndex; a++) {
- if(bids[a].getUser().getName().equals(name)) {
- bids[a]=null;
- bidIndex--;
- break;
- }
- }
- sortBids();
- public void sortBids() {
- if(bidIndex > 1) {
- for(int a = 0; a < bidIndex -1; a++) {
- for(int b = a + 1; b < bidIndex; b++) {
- if(bids[a] == null || bids[a].getBid() < bids[b].getBid()) {
- Bid temp = bids[a];
- bids[a] = bids[b];
- bids[b] = temp;
- }
- }
- String[] items = new String[] {"String1", "String2", "String3"};
- items[1] = null;
- Map<String, Bid> bids = new HashMap<String, Bid>();
- Bid bid1 = new Bid(/*...*/);
- Bid bid2 = new Bid(/*...*/);
- // Add bids to the map
- bids.put("Wow", bid1);
- bids.put("Boy", bid2);
- // Get any of these objects
- Bid retrievedBid = bids.get("Wow");
- // Or remove them
- bids.remove("Wow");
- Bid[] bidsArray = new Bid[0];
- bidsArray = bids.values().toArray(bidsArray);
Add Comment
Please, Sign In to add comment