当前位置: 首页>>代码示例>>Java>>正文


Java AbstractCollection类代码示例

本文整理汇总了Java中java.util.AbstractCollection的典型用法代码示例。如果您正苦于以下问题:Java AbstractCollection类的具体用法?Java AbstractCollection怎么用?Java AbstractCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AbstractCollection类属于java.util包,在下文中一共展示了AbstractCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkOnAbsentFalsePositive

import java.util.AbstractCollection; //导入依赖的package包/类
private void checkOnAbsentFalsePositive(int hashId, int numInsertions,
    final RetouchedBloomFilter filter, Digits digits, short removeSchema) {
  AbstractCollection<Key> falsePositives = FALSE_POSITIVE_UNDER_1000
      .get(hashId);

  if (falsePositives == null)
    Assert.fail(String.format("false positives for hash %d not founded",
        hashId));

  filter.addFalsePositive(falsePositives);

  for (int i = digits.getStart(); i < numInsertions; i += 2) {
    filter.add(new Key(Integer.toString(i).getBytes()));
  }

  for (Key key : falsePositives) {
    filter.selectiveClearing(key, removeSchema);
  }

  for (int i = 1 - digits.getStart(); i < numInsertions; i += 2) {
    assertFalse(" testRetouchedBloomFilterAddFalsePositive error " + i,
        filter.membershipTest(new Key(Integer.toString(i).getBytes())));
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:25,代码来源:TestBloomFilters.java

示例2: test_addAllLjava_util_Collection

import java.util.AbstractCollection; //导入依赖的package包/类
/**
 * @tests java.util.AbstractCollection#addAll(java.util.Collection)
 */
public void test_addAllLjava_util_Collection() {
    final Collection<String> fixtures = Arrays.asList("0", "1", "2");
    AbstractCollection<String> ac = new AbstractCollection<String>() {

        @Override
        public boolean add(String object) {
            assertTrue(fixtures.contains(object));
            return true;
        }

        @Override
        public Iterator<String> iterator() {
            fail("iterator should not get called");
            return null;
        }

        @Override
        public int size() {
            fail("size should not get called");
            return 0;
        }
        
    };
    assertTrue(ac.addAll(fixtures));
}
 
开发者ID:Sellegit,项目名称:j2objc,代码行数:29,代码来源:AbstractCollectionTest.java

示例3: testContextStartup

import java.util.AbstractCollection; //导入依赖的package包/类
/**
 * Check context startup and shutdown
 */
public void testContextStartup() throws Exception
{
    getConfiguration(TreeSet.class);
    getConfiguration(HashSet.class);
    getConfiguration(ArrayList.class);
    getConfiguration(AbstractCollection.class);
    try
    {
        getConfiguration(Collection.class);
        fail("Failed to detect incompatible class hierarchy");
    }
    catch (Throwable e)
    {
        // Expected
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-core,代码行数:20,代码来源:HierarchicalSqlSessionFactoryBeanTest.java

示例4: values

import java.util.AbstractCollection; //导入依赖的package包/类
@Override
public Collection<Object> values() {
    return new AbstractCollection<Object>() {

        @Override
        public Iterator<Object> iterator() {
            return ImmutableObjectMap.this.keySet().stream().map(key -> ImmutableObjectMap.this.get(key))
                    .iterator();
        }

        @Override
        public int size() {
            return fieldMap.size();
        }

    };
}
 
开发者ID:primeval-io,项目名称:primeval-reflex,代码行数:18,代码来源:ImmutableObjectMap.java

示例5: htmlForObject

import java.util.AbstractCollection; //导入依赖的package包/类
protected String htmlForObject(Object obj) {
	StringBuffer sb = new StringBuffer();
	if (obj != null){
		if (GeneralHtml.class.isInstance(obj)) {
			sb.append(((GeneralHtml) obj).toHtml());				
		} else if (AbstractCollection.class.isInstance(obj)) {
			Iterator colIt = ((AbstractCollection) obj).iterator();
			while(colIt.hasNext()) {
				sb.append(this.htmlForObject(colIt.next()));
			}			
		} else {
			sb.append(obj.toString());
		}
	}
	return(sb.toString());
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:17,代码来源:GeneralHtml.java

示例6: a

import java.util.AbstractCollection; //导入依赖的package包/类
private static Collection<Object> a(Class<?> cls, Type type) {
    if (cls == AbstractCollection.class) {
        return new ArrayList();
    }
    if (cls.isAssignableFrom(HashSet.class)) {
        return new HashSet();
    }
    if (cls.isAssignableFrom(LinkedHashSet.class)) {
        return new LinkedHashSet();
    }
    if (cls.isAssignableFrom(TreeSet.class)) {
        return new TreeSet();
    }
    if (cls.isAssignableFrom(ArrayList.class)) {
        return new ArrayList();
    }
    if (cls.isAssignableFrom(EnumSet.class)) {
        return EnumSet.noneOf(type instanceof ParameterizedType ? ((ParameterizedType) type).getActualTypeArguments()[0] : Object.class);
    }
    try {
        return (Collection) cls.newInstance();
    } catch (Exception e) {
        throw new IllegalArgumentException("create instane error, class " + cls.getName());
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:26,代码来源:b.java

示例7: values

import java.util.AbstractCollection; //导入依赖的package包/类
@Override
public Collection<V> values() {
  return new AbstractCollection<V>() {
    @Override
    public void clear() {
      ExpiringMap.this.clear();
    }

    @Override
    public boolean contains(Object value) {
      return containsValue(value);
    }

    @Override
    public Iterator<V> iterator() {
      return (entries instanceof EntryLinkedHashMap) ? ((EntryLinkedHashMap<K, V>) entries).new ValueIterator()
          : ((EntryTreeHashMap<K, V>) entries).new ValueIterator();
    }

    @Override
    public int size() {
      return ExpiringMap.this.size();
    }
  };
}
 
开发者ID:ProtocolSupport,项目名称:ProtocolSupportPocketStuff,代码行数:26,代码来源:ExpiringMap.java

示例8: functional

import java.util.AbstractCollection; //导入依赖的package包/类
/** Returns a collection view of the values from this
       <code>BijMap</code>.  The view is fully functional (i.e.,
       allows mutation) and connected to this bijective map (i.e.,
       changes in one of them are reflected in the other one). */
   public Collection<B> values() {
return new AbstractCollection<B>() {
    public int size() { return map.size(); }
    public Iterator<B> iterator() {
	return 
	    DSUtil.<Map.Entry<A,B>,B>mapIterator
	    (BijMap.this.entrySet().iterator(),
	     new Function<Map.Entry<A,B>,B>() {
		public B f(Map.Entry<A,B> entry) {
		    return entry.getValue();
		}
	    });
    }
    public boolean remove(Object b) {
	return BijMap.this.rev().remove(b) != null;
    }
    public void clear() {
	BijMap.this.clear();
    }
};
   }
 
开发者ID:protegeproject,项目名称:jpaul,代码行数:26,代码来源:BijMap.java

示例9: values

import java.util.AbstractCollection; //导入依赖的package包/类
/** Returns an unmodifiable collection view of the values from this map. */
   public final Collection<V> values() {
return new AbstractCollection<V>() {
    public Iterator<V> iterator() {
	final Iterator<Map.Entry<K,V>> ite = entryIterator();
	return new Iterator<V>() {
	    public boolean hasNext() { return ite.hasNext(); }
	    public void    remove()  { ite.remove(); }
	    public V       next()    { return ite.next().getValue(); }
	};
    }
    public int size() {
	return size;
    }
};
   }
 
开发者ID:protegeproject,项目名称:jpaul,代码行数:17,代码来源:NoCompTreeMap.java

示例10: collection

import java.util.AbstractCollection; //导入依赖的package包/类
private <V> Collection<V> collection(final boolean forwards, final Function<Cell, V> f)
{
    final Holder ref = this.ref;
    return new AbstractCollection<V>()
    {
        public Iterator<V> iterator()
        {
            return Iterators.transform(BTree.<Cell>slice(ref.tree, forwards), f);
        }

        public int size()
        {
            return BTree.slice(ref.tree, true).count();
        }
    };
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:17,代码来源:AtomicBTreeColumns.java

示例11: getFields

import java.util.AbstractCollection; //导入依赖的package包/类
@Nonnull
@Override
public Collection<? extends ImmutableField> getFields() {
    return new AbstractCollection<ImmutableField>() {
        @Nonnull
        @Override
        public Iterator<ImmutableField> iterator() {
            return Iterators.concat(staticFields.iterator(), instanceFields.iterator());
        }

        @Override
        public int size() {
            return staticFields.size() + instanceFields.size();
        }
    };
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:17,代码来源:ImmutableClassDef.java

示例12: getMethods

import java.util.AbstractCollection; //导入依赖的package包/类
@Nonnull
@Override
public Collection<? extends ImmutableMethod> getMethods() {
    return new AbstractCollection<ImmutableMethod>() {
        @Nonnull
        @Override
        public Iterator<ImmutableMethod> iterator() {
            return Iterators.concat(directMethods.iterator(), virtualMethods.iterator());
        }

        @Override
        public int size() {
            return directMethods.size() + virtualMethods.size();
        }
    };
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:17,代码来源:ImmutableClassDef.java

示例13: getStaticInitializers

import java.util.AbstractCollection; //导入依赖的package包/类
@Nullable
@Override
public Collection<? extends EncodedValue> getStaticInitializers(
        @Nonnull PoolClassDef classDef) {
    final SortedSet<Field> sortedStaticFields = classDef.getStaticFields();

    final int lastIndex = CollectionUtils.lastIndexOf(sortedStaticFields, HAS_INITIALIZER);
    if (lastIndex > -1) {
        return new AbstractCollection<EncodedValue>() {
            @Nonnull
            @Override
            public Iterator<EncodedValue> iterator() {
                return FluentIterable.from(sortedStaticFields)
                        .limit(lastIndex + 1)
                        .transform(GET_INITIAL_VALUE).iterator();
            }

            @Override
            public int size() {
                return lastIndex + 1;
            }
        };
    }
    return null;
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:26,代码来源:ClassPool.java

示例14: getFields

import java.util.AbstractCollection; //导入依赖的package包/类
@Nonnull
@Override
public Collection<Field> getFields() {
    return new AbstractCollection<Field>() {
        @Nonnull
        @Override
        public Iterator<Field> iterator() {
            return Iterators.mergeSorted(
                    ImmutableList.of(staticFields.iterator(), instanceFields.iterator()),
                    Ordering.natural());
        }

        @Override
        public int size() {
            return staticFields.size() + instanceFields.size();
        }
    };
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:19,代码来源:PoolClassDef.java

示例15: getMethods

import java.util.AbstractCollection; //导入依赖的package包/类
@Nonnull
@Override
public Collection<PoolMethod> getMethods() {
    return new AbstractCollection<PoolMethod>() {
        @Nonnull
        @Override
        public Iterator<PoolMethod> iterator() {
            return Iterators.mergeSorted(
                    ImmutableList.of(directMethods.iterator(), virtualMethods.iterator()),
                    Ordering.natural());
        }

        @Override
        public int size() {
            return directMethods.size() + virtualMethods.size();
        }
    };
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:19,代码来源:PoolClassDef.java


注:本文中的java.util.AbstractCollection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。