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


Java ICommonsSet类代码示例

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


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

示例1: _testPutRandom

import com.helger.commons.collection.impl.ICommonsSet; //导入依赖的package包/类
private void _testPutRandom (final float fillFactor)
{
  final Random aRandom = RandomHelper.getRandom ();
  final int SIZE = 100 * 1000;
  final ICommonsSet <Integer> set = new CommonsHashSet <> (SIZE);
  final int [] vals = new int [SIZE];
  while (set.size () < SIZE)
    set.add (Integer.valueOf (aRandom.nextInt ()));
  int i = 0;
  for (final Integer v : set)
    vals[i++] = v.intValue ();

  final IntObjectMap <String> map = _makeMap (100, fillFactor);
  for (i = 0; i < vals.length; ++i)
  {
    assertNull ("Inserting " + vals[i], map.put (vals[i], _make (vals[i])));
    assertEquals (i + 1, map.size ());
    assertEquals (_make (vals[i]), map.get (vals[i]));
  }
  // now check the final state
  for (i = 0; i < vals.length; ++i)
    assertEquals (_make (vals[i]), map.get (vals[i]));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:24,代码来源:IntObjectMapTest.java

示例2: _testPutRandom

import com.helger.commons.collection.impl.ICommonsSet; //导入依赖的package包/类
private void _testPutRandom (final float fillFactor)
{
  final Random aRandom = RandomHelper.getRandom ();
  final int SIZE = 100 * 1000;
  final ICommonsSet <Integer> set = new CommonsHashSet<> (SIZE);
  final int [] vals = new int [SIZE];
  while (set.size () < SIZE)
    set.add (Integer.valueOf (aRandom.nextInt ()));
  int i = 0;
  for (final Integer v : set)
    vals[i++] = v.intValue ();

  final IntIntMap map = _makeMap (100, fillFactor);
  for (i = 0; i < vals.length; ++i)
  {
    assertEquals (0, map.put (vals[i], vals[i]));
    assertEquals (i + 1, map.size ());
    assertEquals (vals[i], map.get (vals[i]));
  }
  // now check the final state
  for (i = 0; i < vals.length; ++i)
    assertEquals (vals[i], map.get (vals[i]));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:24,代码来源:IntIntMapTest.java

示例3: testAll

import com.helger.commons.collection.impl.ICommonsSet; //导入依赖的package包/类
@Test
public void testAll ()
{
  // Ensure they are unique....
  final boolean bOld = RandomHelper.isUseSecureRandom ();
  RandomHelper.setUseSecureRandom (false);
  try
  {
    final ICommonsSet <String> aAll = new CommonsHashSet <> ();
    for (int i = 0; i < 1000; i++)
      assertTrue (aAll.add (AuthTokenIDGenerator.generateNewTokenID ()));
  }
  finally
  {
    RandomHelper.setUseSecureRandom (bOld);
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:18,代码来源:AuthTokenIDGeneratorTest.java

示例4: testAll

import com.helger.commons.collection.impl.ICommonsSet; //导入依赖的package包/类
@Test
public void testAll ()
{
  final ICommonsSet <Class <?>> aClasses = new CommonsHashSet <> ();
  final ICommonsSet <String> aFilenames = new CommonsHashSet <> ();
  for (final EUBL22DocumentType e : EUBL22DocumentType.values ())
  {
    assertNotNull (e.getImplementationClass ());
    assertTrue (StringHelper.hasText (e.getLocalName ()));
    assertTrue (StringHelper.hasText (e.getNamespaceURI ()));
    assertTrue (e.getAllXSDPaths ().size () >= 1);
    for (final IReadableResource aRes : e.getAllXSDResources ())
      assertTrue (e.name (), aRes.exists ());
    assertNotNull (e.getSchema ());
    assertSame (e.getSchema (), e.getSchema ());
    assertSame (e, EUBL22DocumentType.valueOf (e.name ()));
    assertTrue (aClasses.add (e.getImplementationClass ()));
    assertTrue (aFilenames.add (e.getAllXSDPaths ().getFirst ()));
  }
}
 
开发者ID:phax,项目名称:ph-ubl,代码行数:21,代码来源:EUBL22DocumentTypeTest.java

示例5: reinitialize

import com.helger.commons.collection.impl.ICommonsSet; //导入依赖的package包/类
/**
 * Reinitialize all protocols. Adds all {@link EURLProtocol} values and
 * invokes all SPI implementations.
 */
public void reinitialize ()
{
  m_aRWLock.writeLocked ( () -> {
    m_aProtocols.clear ();

    // Add all default protocols
    for (final EURLProtocol aProtocol : EURLProtocol.values ())
      m_aProtocols.put (aProtocol.getProtocol (), aProtocol);
  });

  // Load all SPI implementations
  for (final IURLProtocolRegistrarSPI aRegistrar : ServiceLoaderHelper.getAllSPIImplementations (IURLProtocolRegistrarSPI.class))
  {
    final ICommonsSet <? extends IURLProtocol> aURLProtocols = aRegistrar.getAllProtocols ();
    if (aURLProtocols != null)
      for (final IURLProtocol aSPIProtocol : aURLProtocols)
        registerProtocol (aSPIProtocol);
  }

  if (s_aLogger.isDebugEnabled ())
    s_aLogger.debug (getRegisteredProtocolCount () + " URL protocols registered");
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:27,代码来源:URLProtocolRegistry.java

示例6: getConcatenatedSet

import com.helger.commons.collection.impl.ICommonsSet; //导入依赖的package包/类
@Nullable
@ReturnsMutableCopy
public static <ELEMENTTYPE> ICommonsSet <ELEMENTTYPE> getConcatenatedSet (@Nullable final Collection <? extends ELEMENTTYPE> aCont1,
                                                                          @Nullable final Collection <? extends ELEMENTTYPE> aCont2)
{
  final int nSize1 = getSize (aCont1);
  if (nSize1 == 0)
    return newSet (aCont2);

  final int nSize2 = getSize (aCont2);
  if (nSize2 == 0)
    return newSet (aCont1);

  final ICommonsSet <ELEMENTTYPE> ret = newSet (nSize1 + nSize2);
  ret.addAll (aCont1);
  ret.addAll (aCont2);
  return ret;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:19,代码来源:CollectionHelper.java

示例7: testRedundancy

import com.helger.commons.collection.impl.ICommonsSet; //导入依赖的package包/类
@Ignore ("Simply wrong assumption")
@Test
public void testRedundancy ()
{
  final ICommonsList <String> aInputList = new CommonsArrayList <> ("a", "b", "c", "d", "e", "f", "g", "h");

  // Build all permutations of the input list, using all available slots
  final ICommonsSet <ICommonsList <String>> aSimplePermutations = new CommonsHashSet <> ();
  CombinationGenerator.addAllPermutations (aInputList, aInputList.size (), aSimplePermutations);

  // Flexible combination generator
  final ICommonsSet <ICommonsList <String>> aFlexiblePermutations = CombinationGeneratorFlexible.getCombinations (aInputList,
                                                                                                                  true);
  assertTrue (aFlexiblePermutations.size () >= aSimplePermutations.size ());

  // Now the assumptions: I assume that all permutations from the flexible
  // generator are also contained in all permutations
  for (final ICommonsList <String> aList : aFlexiblePermutations)
    assertTrue (aList.toString (), aSimplePermutations.contains (aList));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:21,代码来源:CombinationGeneratorFlexibleTest.java

示例8: testSet

import com.helger.commons.collection.impl.ICommonsSet; //导入依赖的package包/类
@Test
public void testSet ()
{
  final ICommonsSet <String> aCont = new CommonsHashSet <> ("a", "b", "c");
  assertTrue (EqualsHelper.equalsCollection (aCont, aCont));
  assertTrue (EqualsHelper.equalsCollection (aCont, CollectionHelper.makeUnmodifiable (aCont)));
  assertTrue (EqualsHelper.equalsCollection (aCont, Collections.synchronizedSet (aCont)));
  assertTrue (EqualsHelper.equalsCollection (aCont, new CommonsHashSet <> (aCont)));
  assertTrue (EqualsHelper.equalsCollection (aCont, new CommonsLinkedHashSet <> (aCont)));
  assertTrue (EqualsHelper.equalsCollection (aCont, new CommonsTreeSet <> (aCont)));
  assertTrue (EqualsHelper.equalsCollection (new CommonsHashSet <String> (), new CommonsLinkedHashSet <String> ()));
  assertTrue (EqualsHelper.equalsCollection (new CommonsTreeSet <String> (), new CommonsHashSet <String> ()));

  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsHashSet <String> ()));
  assertFalse (EqualsHelper.equalsCollection (new CommonsHashSet <String> (), aCont));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsTreeSet <String> ()));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsHashSet <> ("a", "b")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsHashSet <> ("A", "b", "c")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsHashSet <> ("a", "B", "c")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsHashSet <> ("a", "b", "C")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsHashSet <> ("a", "b", "c", "d")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsArrayList <> ("a", "b", "c")));
  assertFalse (EqualsHelper.equalsCollection (aCont, ArrayHelper.newArray ("a", "b", "c")));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:25,代码来源:EqualsHelperTest.java

示例9: entrySet

import com.helger.commons.collection.impl.ICommonsSet; //导入依赖的package包/类
@Nonnull
@ReturnsMutableCopy
@CodingStyleguideUnaware
public Set <Map.Entry <KEYTYPE, VALUETYPE>> entrySet ()
{
  final ICommonsSet <Map.Entry <KEYTYPE, VALUETYPE>> aSet = new CommonsHashSet<> (size ());
  if (m_bHasElement)
    aSet.add (new MapEntry<> (m_aKey, m_aValue));
  return aSet;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:11,代码来源:SingleElementMap.java

示例10: directGetEnumValues

import com.helger.commons.collection.impl.ICommonsSet; //导入依赖的package包/类
/**
 * @return The Set with the enum values - only used for derived classes. Never
 *         <code>null</code>.
 */
@Nonnull
@ReturnsMutableObject ("Design")
protected final ICommonsSet <String> directGetEnumValues ()
{
  return m_aEnumValues;
}
 
开发者ID:phax,项目名称:ph-css,代码行数:11,代码来源:CSSPropertyEnum.java

示例11: getAllLocalNames

import com.helger.commons.collection.impl.ICommonsSet; //导入依赖的package包/类
/**
 * @return A non-<code>null</code> set of all supported UBL 2.0 document
 *         element local names.
 */
@Nonnull
@ReturnsMutableCopy
public static ICommonsSet <String> getAllLocalNames ()
{
  return s_aLocalName2DocType.copyOfKeySet ();
}
 
开发者ID:phax,项目名称:ph-ubl,代码行数:11,代码来源:UBL20DocumentTypes.java

示例12: testAll

import com.helger.commons.collection.impl.ICommonsSet; //导入依赖的package包/类
@Test
public void testAll ()
{
  IMultiMapSetBased <String, String, ? extends ICommonsSet <String>> aMultiMap = new MultiHashMapLinkedHashSetBased <> ();
  testEmpty (aMultiMap);
  aMultiMap = new MultiHashMapLinkedHashSetBased <> (getKey1 (), getValue1 ());
  testOne (aMultiMap);
  aMultiMap = new MultiHashMapLinkedHashSetBased <> (getKey1 (), getValueSetOrdered1 ());
  testOne (aMultiMap);
  aMultiMap = new MultiHashMapLinkedHashSetBased <> (getMapSetOrdered1 ());
  testOne (aMultiMap);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:13,代码来源:MultiHashMapLinkedHashSetBasedTest.java

示例13: testAll

import com.helger.commons.collection.impl.ICommonsSet; //导入依赖的package包/类
@Test
public void testAll ()
{
  IMultiMapSetBased <String, String, ? extends ICommonsSet <String>> aMultiMap = new MultiTreeMapLinkedHashSetBased <> ();
  testEmpty (aMultiMap);
  aMultiMap = new MultiTreeMapLinkedHashSetBased <> (getKey1 (), getValue1 ());
  testOne (aMultiMap);
  aMultiMap = new MultiTreeMapLinkedHashSetBased <> (getKey1 (), getValueSetOrdered1 ());
  testOne (aMultiMap);
  aMultiMap = new MultiTreeMapLinkedHashSetBased <> (getMapSetOrdered1 ());
  testOne (aMultiMap);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:13,代码来源:MultiTreeMapLinkedHashSetBasedTest.java

示例14: getAllLocalNames

import com.helger.commons.collection.impl.ICommonsSet; //导入依赖的package包/类
/**
 * @return A non-<code>null</code> set of all supported UBL 2.2 document
 *         element local names.
 */
@Nonnull
@ReturnsMutableCopy
public static ICommonsSet <String> getAllLocalNames ()
{
  return s_aLocalName2DocType.copyOfKeySet ();
}
 
开发者ID:phax,项目名称:ph-ubl,代码行数:11,代码来源:UBL22DocumentTypes.java

示例15: testAll

import com.helger.commons.collection.impl.ICommonsSet; //导入依赖的package包/类
@Test
public void testAll ()
{
  IMultiMapSetBased <String, String, ? extends ICommonsSet <String>> aMultiMap = new MultiConcurrentHashMapHashSetBased <> ();
  testEmpty (aMultiMap);
  aMultiMap = new MultiConcurrentHashMapHashSetBased <> (getKey1 (), getValue1 ());
  testOne (aMultiMap);
  aMultiMap = new MultiConcurrentHashMapHashSetBased <> (getKey1 (), getValueSet1 ());
  testOne (aMultiMap);
  aMultiMap = new MultiConcurrentHashMapHashSetBased <> (getMapSet1 ());
  testOne (aMultiMap);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:13,代码来源:MultiConcurrentHashMapHashSetBasedTest.java


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