Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- http://pastebin.com/U9kMi5CU
- import chn.util.*;
- import apcslib.*;
- import java.util.*;
- public class Item implements Comparable{
- private int myId;
- private int myInv;
- public Item(int id, int inv){
- myId = id;
- myInv = inv;
- }
- public int getId(){
- return myId;
- }
- public int getInv(){
- return myInv;
- }
- public int compareTo(Object otherObject){
- Item right = (Item)otherObject;
- return (myId - right.getId());
- }
- public boolean equals(Object otherObject){
- return compareTo(otherObject) == 0;
- }
- public String toString(){
- return (myId + " " + myInv);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment