Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // @Override
- // public boolean isEmpty() {
- // boolean f = false;
- // try {
- //
- // if (map.length == 0) {
- // semaphore.acquire();
- // f = true;
- // semaphore.release();
- // }
- // } catch (InterruptedException e) {
- // e.printStackTrace();
- // }
- // return f;
- // }
- //
- //
- // @Override
- // public boolean containsKey(Object key) {
- // boolean f = false;
- // try {
- // for (int i = 0; i < map.length; ++i) {
- // if (key.equals(map[i].get(key))) {
- // semaphore.acquire();
- // f = true;
- // semaphore.release();
- // }
- // }
- // } catch (InterruptedException e) {
- // e.printStackTrace();
- // }
- // return f;
- //
- // }
- //
- // @Override
- // public boolean containsValue(Object value) {
- // boolean f = false;
- // try {
- // for (HashMap<K, V> m : map) {
- // if (value.equals(m.get(value))) {
- // semaphore.acquire();
- // f = true;
- // semaphore.release();
- // }
- // }
- // } catch (InterruptedException e) {
- // e.printStackTrace();
- // }
- // return f;
- // }
- //
- // @Override
- // public V get(Object key) {
- // V q = null;
- // try {
- // for (HashMap<K, V> m : map) {
- // if (key.equals(m.get(key))) q = (m.get(values()));
- // semaphore.acquire();
- // q = m.get(values());
- // semaphore.release();
- // }
- // } catch (InterruptedException e) {
- // e.printStackTrace();
- // }
- // return q;
- // }
- //
- // public V put(K key, V value) {
- // if(containsKey(key)){
- // K prevKey;
- // V prevVal = null;
- //
- // for (int i = 0; i < map.length; ++i) {
- // if (key.equals(map[i].get(key))){
- // prevKey= (K) map[i].get(key);
- // prevVal=map[i].get(value);
- // map[i]=new HashMap<K,V>((int) prevKey, (float) value);
- // }
- // }
- // return prevVal;
- // }
- // else {
- // HashMap<K, V>[] copy = new HashMap[map.length + 1];
- // for (int i = 0; i < map.length; ++i) {
- // copy[i] = map[i];
- // }
- // copy[map.length] = new HashMap<K,V>((K) key, (V) value);
- // map=copy;
- // return null;
- // }
- // }
- //
- //
- // @Override
- // public synchronized V remove(Object o) {
- // if (containsKey(o)) {
- // Pair<K, V>[] copy = new Pair[map.length - 1];
- // V prevVal = null;
- // boolean wasKey = false;
- // for (int i = 0; i < map.length; ++i) {
- // if (o.equals(map[i].getKey())) {
- // wasKey = true;
- // prevVal = map[i].getValue();
- // continue;
- // }
- // if (!wasKey) copy[i] = map[i];
- // else copy[i - 1] = map[i];
- // }
- // map = copy;
- // return prevVal;
- // } else return null;
- // }
- //
- // @Override
- // public synchronized void putAll(Map addedMap) {
- // Iterator<Entry<K, V>> iterator = addedMap.entrySet().iterator();
- // while (iterator.hasNext()) {
- // Map.Entry<K, V> pair = iterator.next();
- // this.put(pair.getKey(), pair.getValue());
- // }
- // }
- //
- // @Override
- // public synchronized void clear() {
- // map = new Pair[0];
- // }
- //
- // @Override
- // public synchronized Set<K> keySet() {
- // Set<K> set = null;
- // Iterator<Entry<K, V>> iterator = this.entrySet().iterator();
- // while (iterator.hasNext()) {
- // Entry<K, V> pair = iterator.next();
- // set.add(pair.getKey());
- // }
- // return set;
- // }
- //
- // @Override
- // public synchronized Collection values() {
- // Collection<V> collection = new ArrayList<>();
- // for (int i = 0; i < map.length; ++i) {
- // collection.add(map[i].getValue());
- // }
- // return collection;
- // }
- //
- // @Override
- // public synchronized Set<Entry<K, V>> entrySet() {
- // Set<Entry<K, V>> set = new HashSet<>();
- // for (int i = 0; i < map.length; ++i) {
- // set.add(new AbstractMap.SimpleEntry<>(map[i].getKey(), map[i].getValue()));
- // }
- // return set;
- // }
- //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement