List of usage examples for java.util LinkedHashSet LinkedHashSet
public LinkedHashSet()
From source file:net.landora.video.filestate.DirectoryUUIDChecker.java
public static void setUUID(File directory, String uuid) { try {// ww w . java 2 s . co m File uuidFile = new File(directory, UUID_FILE); Set<String> uuids = new LinkedHashSet<String>(); if (uuidFile.exists()) { uuids.addAll(FileUtils.readLines(uuidFile)); } uuids.add(uuid); FileUtils.writeLines(uuidFile, uuids); } catch (Exception e) { log.error("Error adding directory uuid: " + directory, e); } }
From source file:Main.java
/** * Creates an empty {@link LinkedHashSet} that uses a little cleverness * with Java's generics. Useful for eliminating redundant type * information and declaring fields as {@code final}. * * <p>Please consider using {@link #newLinkedHashSet(int)} or * {@link #newLinkedHashSet(java.util.Collection)} instead of this method. * /*from w ww.java2s . c o m*/ * @return A new, empty {@code LinkedHashSet}. * * @see #newLinkedHashSet(int) * @see #newLinkedHashSet(java.util.Collection) */ @SuppressWarnings({ "CollectionWithoutInitialCapacity" }) public static <E> Set<E> newLinkedHashSet() { return new LinkedHashSet<>(); }
From source file:cop.raml.processor.AbstractProcessorTest.java
protected static boolean runAnnotationProcessor(File dir) throws URISyntaxException { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); Set<JavaFileObject> compilationUnits = new LinkedHashSet<>(); for (File file : (List<File>) FileUtils.listFiles(dir, JAVA_FILE_FILTER, DirectoryFileFilter.INSTANCE)) compilationUnits.add(new SimpleJavaFileObjectImpl(file, JavaFileObject.Kind.SOURCE)); List<String> options = new ArrayList<>(); // options.put("-Apackages=com.bosch"); // options.put("-AfilterRegex=AnalysisController"); // options.put("-Aversion=0.8"); options.add("-d"); options.add("target"); JavaCompiler.CompilationTask task = compiler.getTask(null, null, null, options, null, compilationUnits); task.setProcessors(Collections.singleton(new RestProcessor())); return task.call(); }
From source file:Main.java
/** * Create a {@link LinkedHashSet} of {@link E} and add {@code elements} to the {@link * LinkedHashSet}./*from ww w . jav a 2s. c o m*/ * * @param elements Elements to add to set. * @param <E> Element type. * @return {@link LinkedHashSet} of {@link E} with {@code elements}. */ @SafeVarargs public static <E> LinkedHashSet<E> linkedSetOf(E... elements) { LinkedHashSet<E> set = new LinkedHashSet<>(); Collections.addAll(set, elements); return set; }
From source file:co.turnus.analysis.util.AnalysisUtil.java
public static double[] linspaced(double min, double max, int points) { Set<Double> values = new LinkedHashSet<Double>(); double current = min; double delta = (max - min) / ((double) points - 1); do {/* w ww . j a v a 2 s . c om*/ values.add(current); current += delta; } while (current < (max + delta / 2)); return ArrayUtils.toPrimitive(values.toArray(new Double[0])); }
From source file:ca.on.oicr.pde.tools.BEDFileUtils.java
/** * Gets the set (no duplicates) of chromosomes from a collection of bed files. * * @param bedFiles A collection of bed file paths * * @return The set of chromosomes (no duplicates) * * @throws FileNotFoundException, IOException *//* w w w .ja v a 2 s . c o m*/ public static Set<String> getChromosomes(Collection<String> bedFiles) throws FileNotFoundException, IOException { Set<String> chrs = new LinkedHashSet<>(); for (String bedFile : bedFiles) { chrs.addAll(BEDFileUtils.getChromosomes(bedFile)); } return chrs; }
From source file:com.linecorp.armeria.server.docs.ServiceInfo.java
static ServiceInfo of(Class<?> serviceClass, Iterable<EndpointInfo> endpoints, Map<Class<?>, ? extends TBase<?, ?>> sampleRequests) throws ClassNotFoundException { requireNonNull(serviceClass, "serviceClass"); final String name = serviceClass.getName(); final ClassLoader serviceClassLoader = serviceClass.getClassLoader(); final Class<?> interfaceClass = Class.forName(name + "$Iface", false, serviceClassLoader); final Method[] methods = interfaceClass.getDeclaredMethods(); final Map<String, String> docStrings = ThriftDocString.getAllDocStrings(serviceClassLoader); final List<FunctionInfo> functions = new ArrayList<>(methods.length); final Set<ClassInfo> classes = new LinkedHashSet<>(); for (Method method : methods) { final FunctionInfo function = FunctionInfo.of(method, sampleRequests, name, docStrings); functions.add(function);/*from ww w. j av a 2 s . c o m*/ addClassIfPossible(classes, function.returnType()); function.parameters().stream().forEach(p -> addClassIfPossible(classes, p.type())); function.exceptions().stream().forEach(e -> { e.fields().stream().forEach(f -> addClassIfPossible(classes, f.type())); addClassIfPossible(classes, e); }); } return new ServiceInfo(name, functions, classes, endpoints, docStrings.get(name)); }
From source file:com.wickettraining.modelproxy.domain.PhoneNumberTest.java
@SuppressWarnings("unchecked") public void testUseInLinkedHashSet() throws Exception { Set<PhoneNumber> set = new LinkedHashSet<PhoneNumber>(); PhoneNumber p1 = new PhoneNumber("123"); PhoneNumber p2 = new PhoneNumber("234"); set.add(p1);//w ww . j a v a 2s . c om assertTrue(set.contains(p1)); set.add(p2); assertTrue(set.contains(p2)); Set<PhoneNumber> set2 = (Set<PhoneNumber>) SerializationUtils.clone((Serializable) set); assertTrue(set2.containsAll(set)); assertEquals(set, set2); }
From source file:bz.tsung.jsonapi4j.models.JsonApiDocument.java
public JsonApiDocument() { links = new LinkedHashMap<String, String>(); included = new ArrayList<Resource>(); includedRecs = new LinkedHashSet<Resource>(); data = null;//from w ww . ja v a 2 s . co m }
From source file:com.yahoo.elide.jsonapi.models.JsonApiDocument.java
public JsonApiDocument(Data<Resource> data) { links = new LinkedHashMap<>(); included = new ArrayList<>(); includedRecs = new LinkedHashSet<>(); this.data = data; }