Ejemplo n.º 1
0
 @SuppressWarnings("unchecked")
 @Override
 public boolean containsAll(Collection<?> c, ElementMatcher<? super Entry<K, V>> matcher) {
   this.requiredEnabled();
   RootData<K, V> rootData = this.getRootData();
   if (matcher == null) {
     UnifiedComparator<? super V> valueUnifiedComparator = rootData.valueUnifiedComparator();
     for (Object o : c) {
       if (!(o instanceof Entry<?, ?>)) {
         return false;
       }
       Entry<K, V> e = (Entry<K, V>) o;
       Ref<V> ref = rootData.visionallyRead(e.getKey(), null);
       if (ref == null) {
         rootData.load();
         return this.getBase().containsAll(c, matcher);
       }
       if (ref.get() == null) {
         return false;
       }
       if (!valueUnifiedComparator.equals(ref.get(), e.getValue())) {
         return false;
       }
     }
     return true;
   }
   rootData.load();
   return this.getBase().containsAll(c, matcher);
 }
Ejemplo n.º 2
0
 @Override
 public boolean isEmpty() {
   this.requiredEnabled();
   RootData<K, V> rootData = this.getRootData();
   if (0 == rootData.visionallyReadSize()) {
     return true;
   }
   rootData.load();
   return this.getBase().isEmpty();
 }
Ejemplo n.º 3
0
 @SuppressWarnings("unchecked")
 @Override
 public boolean containsAll(Collection<?> c, ElementMatcher<? super K> matcher) {
   this.requiredEnabled();
   RootData<K, V> rootData = this.<RootData<K, V>>getRootData();
   if (matcher == null) {
     for (Object o : c) {
       Ref<V> ref = rootData.visionallyRead((K) o, null);
       if (ref == null) {
         rootData.load();
         return this.getBase().containsAll(c, matcher);
       }
       if (ref.get() == null) {
         return false;
       }
     }
     return true;
   }
   rootData.load();
   return this.getBase().containsAll(c, matcher);
 }
Ejemplo n.º 4
0
 @SuppressWarnings("unchecked")
 @Override
 public V get(Object key) {
   this.requiredEnabled();
   RootData<K, V> rootData = this.<RootData<K, V>>getRootData();
   Ref<V> ref = rootData.visionallyRead((K) key, null);
   if (ref != null) {
     return ref.get();
   }
   rootData.load();
   return this.getBase().get(key);
 }
Ejemplo n.º 5
0
 @Override
 public int size() {
   this.requiredEnabled();
   RootData<K, V> rootData = this.getRootData();
   if (this.<AbstractLazyXMap<K, V>>getParentMap().getParent() == null) {
     int size = rootData.visionallyReadSize();
     if (size != -1) {
       return size;
     }
   }
   rootData.load();
   return this.getBase().size();
 }
Ejemplo n.º 6
0
 @SuppressWarnings("unchecked")
 @Override
 public boolean contains(Object o, ElementMatcher<? super K> matcher) {
   this.requiredEnabled();
   RootData<K, V> rootData = this.<RootData<K, V>>getRootData();
   if (matcher == null) {
     Ref<V> ref = rootData.visionallyRead((K) o, null);
     if (ref != null) {
       return ref.get() != null;
     }
   }
   rootData.load();
   return this.getBase().contains(o, matcher);
 }