Guest User

Untitled

a guest
Dec 10th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.80 KB | None | 0 0
  1. package javaapplication10;
  2.  
  3. import java.util.HashSet;
  4. import java.util.Objects;
  5. import java.util.Set;
  6.  
  7.  
  8. class ListSet<T> implements Set<T> {
  9.  
  10. private List<T> bs = new LinkedList<T>();
  11.  
  12. @Override
  13. public int size() {
  14. return bs.size();
  15. }
  16.  
  17. @Override
  18. public boolean isEmpty() {
  19. return bs.isEmpty();
  20. }
  21.  
  22. @Override
  23. public boolean contains(Object o) {
  24. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  25. }
  26.  
  27. @Override
  28. public Iterator<T> iterator() {
  29. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  30. }
  31.  
  32. @Override
  33. public Object[] toArray() {
  34. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  35. }
  36.  
  37. @Override
  38. public <T> T[] toArray(T[] a) {
  39. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  40. }
  41.  
  42. @Override
  43. public boolean add(T e) {
  44. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  45. }
  46.  
  47. @Override
  48. public boolean remove(Object o) {
  49. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  50. }
  51.  
  52. @Override
  53. public boolean containsAll(Collection<?> c) {
  54. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  55. }
  56.  
  57. @Override
  58. public boolean addAll(Collection<? extends T> c) {
  59. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  60. }
  61.  
  62. @Override
  63. public boolean retainAll(Collection<?> c) {
  64. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  65. }
  66.  
  67. @Override
  68. public boolean removeAll(Collection<?> c) {
  69. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  70. }
  71.  
  72. @Override
  73. public void clear() {
  74. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  75. }
  76.  
  77. }
  78.  
  79. class Fraction
  80. {
  81. char num, den;
  82. boolean isReal;
  83. float _doubleValue;
  84. String _englishVersion;
  85.  
  86.  
  87. @Override
  88. public boolean equals(Object obj) {
  89. if (this == obj) {
  90. return true;
  91. }
  92. if (obj == null) {
  93. return false;
  94. }
  95. if (getClass() != obj.getClass()) {
  96. return false;
  97. }
  98. final Fraction other = (Fraction) obj;
  99. if (this.num != other.num) {
  100. return false;
  101. }
  102. if (this.den != other.den) {
  103. return false;
  104. }
  105. return true;
  106. }
  107.  
  108. @Override
  109. public int hashCode() {
  110. int hash = 3;
  111. hash = 19 * hash + this.num;
  112. hash = 19 * hash + this.den;
  113. hash = 19 * hash + (this.isReal ? 1 : 0);
  114. hash = 19 * hash + Float.floatToIntBits(this._doubleValue);
  115. hash = 19 * hash + Objects.hashCode(this._englishVersion);
  116. return hash;
  117. }
  118.  
  119. }
  120.  
  121. public class JavaApplication10 {
  122.  
  123.  
  124. public static void main(String[] args) {
  125. Set<String> hashSet = new HashSet<>();
  126. Set<String> listSet = new ListSet<>();
  127.  
  128. String s = randomString();
  129.  
  130.  
  131. }
  132.  
  133. private static String randomString() {
  134. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  135. }
  136.  
  137. }
Add Comment
Please, Sign In to add comment