Ejemplo n.º 1
0
 @Override
 public T get(int index) {
   if (index < 0 || index >= length()) {
     throw new IndexOutOfBoundsException("get(" + index + ")");
   }
   return trie.get(index).get();
 }
Ejemplo n.º 2
0
 @Override
 public Vector<T> removeAll(java.lang.Iterable<? extends T> elements) {
   Objects.requireNonNull(elements, "elements is null");
   HashArrayMappedTrie<T, T> removed = HashArrayMappedTrie.empty();
   for (T element : elements) {
     removed = removed.put(element, element);
   }
   HashArrayMappedTrie<Integer, T> result = HashArrayMappedTrie.empty();
   boolean found = false;
   for (int i = 0; i < length(); i++) {
     T element = get(i);
     if (removed.get(element).isDefined()) {
       found = true;
     } else {
       result = result.put(result.size(), element);
     }
   }
   return found ? (result.isEmpty() ? empty() : new Vector<>(result)) : this;
 }
Ejemplo n.º 3
0
 @Override
 public Option<V> get(K key) {
   return trie.get(key);
 }