Guest User

Untitled

a guest
Jan 19th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. public class ObjectBox {
  2.  
  3. List collection;
  4. /**
  5. * Instantiates a new Object box.
  6. */
  7. public ObjectBox() {
  8. this.collection = new ArrayList<>();
  9. }
  10.  
  11. ObjectBox(final Object[] array) {
  12. collection = Arrays.asList(array);
  13. Collections.sort(collection);
  14. }
  15.  
  16.  
  17. /**
  18. * Add a new Element to Collection
  19. *
  20. * @param o the Object
  21. */
  22. public void add(final Object o){
  23. collection.add(o);
  24. }
  25.  
  26. /**
  27. * Deletes a given Object
  28. * in existing Data
  29. *
  30. * @param o the Object
  31. */
  32. public void delete(final Object o){
  33. collection.remove(o);
  34. }
  35.  
  36. //TODO
  37. @Override
  38. public int hashCode() {
  39. return super.hashCode();
  40. }
  41.  
  42. //TODO
  43. @Override
  44. public boolean equals(Object obj) {
  45. return super.equals(obj);
  46. }
  47.  
  48. @Override
  49. public String toString() {
  50. return super.toString();
  51. }
  52.  
  53. @Override
  54. public int hashCode() {
  55. int result = 31;
  56. result = 17 * result + (collection != null ? collection.hashCode() : 0);
  57. return result;
  58. }
Add Comment
Please, Sign In to add comment