List of usage examples for java.util Set toArray
<T> T[] toArray(T[] a);
From source file:com.yahoo.bullet.result.RecordBox.java
private <T> List<Map<String, T>> asList(Class<T> clazz, Map<String, Object>... entries) { Objects.requireNonNull(clazz); Objects.requireNonNull(entries); List<Map<String, T>> newList = new ArrayList<>(entries.length); for (Map<String, Object> entry : entries) { Set<Map.Entry<String, Object>> data = entry.entrySet(); Map<String, T> newMap = asMap(clazz, data.toArray(new Map.Entry[data.size()])); newList.add(newMap);/*w w w . ja va 2s .c o m*/ } return newList; }
From source file:com.azaptree.services.command.impl.CommandServiceImpl.java
@ManagedAttribute @Override//from w w w .j a v a2s . c o m public String[] getCommandCatalogNames() { final Set<String> catalogNames = new TreeSet<>(commandCatalogs.keySet()); return catalogNames.toArray(new String[catalogNames.size()]); }
From source file:com.gettingagile.tisugly.analyzer.ASMAnalyzer.java
private ASMAnalyzer() { URL[] urls = ((URLClassLoader) Thread.currentThread().getContextClassLoader()).getURLs(); for (URL url : urls) { loadClassesFromClasspath(new File(url.getFile())); }//from ww w. j a va 2 s . c o m globals = dependencyVisitor.getGlobals(); Set<String> classPackages = dependencyVisitor.getPackages(); packageNames = classPackages.toArray(new String[classPackages.size()]); Arrays.sort(packageNames); }
From source file:com.aokyu.dev.pocket.RetrieveResponse.java
public String[] getUIDs() { Set<String> uids = keySet(); return uids.toArray(new String[0]); }
From source file:de.cinovo.cloudconductor.api.model.ModelToJsonTest.java
/** * @throws JsonProcessingException on error */// w w w .j av a 2 s.com @Test public void singleObjects() throws JsonProcessingException { SSHKey key = new SSHKey("akey", "aowner"); System.out.println(this.mapper.writeValueAsString(key)); Set<SSHKey> keys = new HashSet<>(); keys.add(key); System.out.println(this.mapper.writeValueAsString(keys)); System.out.println(this.mapper.writeValueAsString(keys.toArray(new SSHKey[0]))); HashSet<Dependency> hashSet = new HashSet<Dependency>(); hashSet.add(new Dependency("moep", "moep", "<", DependencyType.PROVIDES.toString())); PackageVersion v = new PackageVersion("test", "test", hashSet); System.out.println(this.mapper.writeValueAsString(v)); }
From source file:es.urjc.mctwp.service.commands.imageCmds.SendImageAsSC.java
@Override public Command runCommand() throws Exception { ImageData image = imageDao.findById(imageId); if (image != null) { Set<ImageData> sources = image.getResult().getTask().getImages(); if (sources != null && sources.size() == 1) { ImageData orig = (sources.toArray(new ImageData[0]))[0]; imageUtils.sendImageAsSC(image.getImageId(), orig.getStudy().getCollection(), destination, dicomHeader);/*from w ww . j a v a2 s .c o m*/ createLogComment("audit.sendImageAsSC", imageId, getTrial().getCollection(), destination.getHostname()); } } return this; }
From source file:org.opencredo.esper.config.xml.TopLevelOneRefListenerEsperStatementParserTest.java
@Test public void testReferencedListenerRegistered() { assertNotNull(statement);/*from ww w .j ava 2s . c o m*/ assertEquals(EPL, statement.getEPL()); Set<UpdateListener> listeners = statement.getListeners(); assertEquals(1, listeners.size()); UpdateListener[] listenersArray = new UpdateListener[listeners.size()]; listeners.toArray(listenersArray); String className = listenersArray[0].getClass().getName(); assertEquals(LISTENER_TEST_CLASS, className); }
From source file:de.fhg.iais.asc.oai.retriever.MetadataFormatsAndSetNamesRetriever.java
public String[] listSets() { SetCollector consumer = new SetCollector(); listSets(consumer);//from w ww. jav a 2 s . c o m Set<String> sets = consumer.getSpecs(); LOG.debug("Sets are " + sets); return sets != null ? sets.toArray(new String[consumer.getSpecs().size()]) : null; // better returning a zero length array rather than null, but it is correctly checked, so ==> // NOSONAR }
From source file:com.datatorrent.stram.client.AppPackageTest.java
@Test public void testRequiredProperties() { Set<String> requiredProperties = ap.getRequiredProperties(); Assert.assertEquals(2, requiredProperties.size()); String[] rp = requiredProperties.toArray(new String[] {}); Assert.assertEquals("dt.test.required.1", rp[0]); Assert.assertEquals("dt.test.required.2", rp[1]); }
From source file:de.codesourcery.jasm16.emulator.devices.impl.RawImage.java
public int[] getUniqueColors() { final Set<Integer> result = new HashSet<Integer>(); for (int i = 0; i < data.length; i++) { result.add(data[i]);//from w w w . j a v a2 s . co m } return ArrayUtils.toPrimitive(result.toArray(new Integer[result.size()])); }