/** * Creates a new factory. */ public DefaultNameFactory() { pool = new WeakHashSet<>(GenericName.class); }
/** * Creates a new factory. */ public DefaultNameFactory() { pool = new WeakHashSet<>(GenericName.class); }
/** * 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<>(); }
/** * 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<>(); }
methodsByType = new IdentityHashMap<>(); lastMethod = new ThreadLocal<>(); pool = new WeakHashSet<>(MathTransform.class); parser = new AtomicReference<>();
methodsByType = new IdentityHashMap<>(); lastMethod = new ThreadLocal<>(); pool = new WeakHashSet<>(MathTransform.class); parser = new AtomicReference<>();
mtFactory = factory; pool = new WeakHashSet<>(IdentifiedObject.class); cache = new Cache<>(12, 50, true);
mtFactory = factory; pool = new WeakHashSet<>(IdentifiedObject.class); cache = new Cache<>(12, 50, true);
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++) {
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++) {
/** * 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())); } }