org.apache.sis.util.collection.WeakHashSet.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中org.apache.sis.util.collection.WeakHashSet.<init>()方法的一些代码示例,展示了WeakHashSet.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WeakHashSet.<init>()方法的具体详情如下:
包路径:org.apache.sis.util.collection.WeakHashSet
类名称:WeakHashSet
方法名:<init>

WeakHashSet.<init>介绍

[英]Creates a WeakHashSet for elements of the specified type.
[中]为指定类型的元素创建WeakHashSet。

代码示例

代码示例来源:origin: apache/sis

/**
 * Creates a new factory.
 */
public DefaultNameFactory() {
  pool = new WeakHashSet<>(GenericName.class);
}

代码示例来源:origin: org.apache.sis.core/sis-utility

/**
 * Creates a new factory.
 */
public DefaultNameFactory() {
  pool = new WeakHashSet<>(GenericName.class);
}

代码示例来源:origin: apache/sis

/**
 * Constructs a factory with the given default properties.
 * {@code GeodeticObjectFactory} will fallback on the map given to this constructor for any property
 * not present in the map provided to a {@code createFoo(Map<String,?>, …)} method.
 *
 * @param  properties  the default properties, or {@code null} if none.
 */
public GeodeticObjectFactory(Map<String,?> properties) {
  if (properties == null || properties.isEmpty()) {
    properties = Collections.emptyMap();
  } else {
    properties = CollectionsExt.compact(new HashMap<>(properties));
  }
  defaultProperties = properties;
  pool = new WeakHashSet<>(AbstractIdentifiedObject.class);
  parser = new AtomicReference<>();
}

代码示例来源:origin: org.apache.sis.core/sis-referencing

/**
 * Constructs a factory with the given default properties.
 * {@code GeodeticObjectFactory} will fallback on the map given to this constructor for any property
 * not present in the map provided to a {@code createFoo(Map<String,?>, …)} method.
 *
 * @param  properties  the default properties, or {@code null} if none.
 */
public GeodeticObjectFactory(Map<String,?> properties) {
  if (properties == null || properties.isEmpty()) {
    properties = Collections.emptyMap();
  } else {
    properties = CollectionsExt.compact(new HashMap<>(properties));
  }
  defaultProperties = properties;
  pool = new WeakHashSet<>(AbstractIdentifiedObject.class);
  parser = new AtomicReference<>();
}

代码示例来源:origin: org.apache.sis.core/sis-referencing

methodsByType = new IdentityHashMap<>();
lastMethod    = new ThreadLocal<>();
pool          = new WeakHashSet<>(MathTransform.class);
parser        = new AtomicReference<>();

代码示例来源:origin: apache/sis

methodsByType = new IdentityHashMap<>();
lastMethod    = new ThreadLocal<>();
pool          = new WeakHashSet<>(MathTransform.class);
parser        = new AtomicReference<>();

代码示例来源:origin: org.apache.sis.core/sis-referencing

mtFactory = factory;
pool = new WeakHashSet<>(IdentifiedObject.class);
cache = new Cache<>(12, 50, true);

代码示例来源:origin: apache/sis

mtFactory = factory;
pool = new WeakHashSet<>(IdentifiedObject.class);
cache = new Cache<>(12, 50, true);

代码示例来源:origin: apache/sis

final Random random = new Random();
for (int pass=0; pass<NUM_RETRY; pass++) {
  final WeakHashSet<Integer> weakSet = new WeakHashSet<>(Integer.class);
  final HashSet<Integer> strongSet = new HashSet<>();
  for (int i=0; i<SAMPLE_SIZE; i++) {

代码示例来源:origin: apache/sis

final Random random = new Random();
for (int pass=0; pass<NUM_RETRY; pass++) {
  final WeakHashSet<Integer> weakSet = new WeakHashSet<>(Integer.class);
  final HashSet<Integer> strongSet = new HashSet<>();
  for (int i=0; i<SAMPLE_SIZE; i++) {

代码示例来源:origin: apache/sis

/**
   * Tests with array elements.
   */
  @Test
  @DependsOnMethod("testStrongReferences")
  public void testWithArrayElements() {
    final WeakHashSet<int[]> weakSet = new WeakHashSet<>(int[].class);
    final int[] array = new int[] {2, 5, 3};
    assertTrue (weakSet.add(array));
    assertFalse(weakSet.add(array));
    assertFalse(weakSet.add(array.clone()));
    assertTrue (weakSet.add(new int[] {2, 5, 4}));
    assertSame (array, weakSet.unique(array.clone()));
  }
}

相关文章