List of usage examples for java.util Set toArray
<T> T[] toArray(T[] a);
From source file:controller.servlet.AllDataDelete.java
/** * Mtodo stopThreads, permite parar los hilos en ejecucin. *//*from w w w . j a v a 2s . c o m*/ private void stopThreads() { Set<Thread> threadSet = Thread.getAllStackTraces().keySet(); Thread[] threadArray = threadSet.toArray(new Thread[threadSet.size()]); for (Thread thread : threadArray) { if (thread.getName().equals(ThreadName.TRACK_THREAD_NAME) || thread.getName().equals(ThreadName.AMENITIES_THREAD_NAME)) { thread.interrupt(); thread.stop(); } } }
From source file:com.doculibre.constellio.wicket.session.ConstellioSession.java
@Override public Roles getRoles() { if (isSignedIn()) { Set<String> roles = getUser().getRoles(); return new Roles(roles.toArray(new String[] {})); }/* w ww .j a v a 2 s . c o m*/ return null; }
From source file:org.wallerlab.yoink.regionizer.partitioner.SingleExponentialDecayDetectorPartitioner.java
private double calculateTwoAtomsDensityRatio(Set<Atom> neighbourAtoms, Coord coordinate) { // calculate density ratio of two closest atoms of a grid point Atom[] twoAtoms = neighbourAtoms.toArray(new Atom[2]); double densityRatioOfTwoAtoms = atomicDensityRatioCalculator.calculate(coordinate, twoAtoms); return densityRatioOfTwoAtoms; }
From source file:com.blocks.framework.utils.date.StringUtil.java
/** * ???ArrayList/* w w w .j a v a 2s .com*/ * * @param ArrayList * ?? * * @return String ?? */ public static String[] delRepeatData(ArrayList<String> al) { Set<String> set = new HashSet<String>(al); Object objs[] = set.toArray(new String[0]); return (String[]) objs; }
From source file:hoot.services.osm.OsmTestUtils.java
public static Set<Long> createTestRelations(final long changesetId, final Set<Long> nodeIds, final Set<Long> wayIds) throws Exception { Set<Long> relationIds = new LinkedHashSet<Long>(); final Long[] nodeIdsArr = nodeIds.toArray(new Long[] {}); final Long[] wayIdsArr = wayIds.toArray(new Long[] {}); Map<String, String> tags = new HashMap<String, String>(); List<RelationMember> members = new ArrayList<RelationMember>(); members.add(new RelationMember(nodeIdsArr[0], ElementType.Node, "role1")); members.add(new RelationMember(wayIdsArr[1], ElementType.Way, "role3")); members.add(new RelationMember(wayIdsArr[0], ElementType.Way, "role2")); members.add(new RelationMember(nodeIdsArr[2], ElementType.Node)); tags.put("key 1", "val 1"); final long firstRelationId = Relation.insertNew(changesetId, mapId, members, tags, conn); relationIds.add(firstRelationId);//from ww w . j av a 2 s. c o m tags.clear(); members.clear(); tags.put("key 2", "val 2"); tags.put("key 3", "val 3"); members.add(new RelationMember(nodeIdsArr[4], ElementType.Node, "role1")); members.add(new RelationMember(firstRelationId, ElementType.Relation, "role1")); relationIds.add(Relation.insertNew(changesetId, mapId, members, tags, conn)); tags.clear(); members.clear(); tags.put("key 4", "val 4"); members.add(new RelationMember(wayIdsArr[1], ElementType.Way)); relationIds.add(Relation.insertNew(changesetId, mapId, members, tags, conn)); tags.clear(); members.clear(); members.add(new RelationMember(nodeIdsArr[2], ElementType.Node, "role1")); relationIds.add(Relation.insertNew(changesetId, mapId, members, null, conn)); members.clear(); return relationIds; }
From source file:com.atlassian.jira.web.action.setup.SetupProductBundleHelper.java
private Cookie[] getCookies() { final Set<Cookie> cookies = sharedVariables.getBundleLicenseCookies(); return cookies.toArray(new Cookie[cookies.size()]); }
From source file:com.streamsets.pipeline.lib.util.ProtobufTypeUtil.java
/** * Loads a Protobuf file descriptor set into an ubermap of file descriptors. * * @param set FileDescriptorSet * @param dependenciesMap FileDescriptor dependency map * @param fileDescriptorMap The populated map of FileDescriptors * @throws StageException// w w w.j av a 2 s .c om */ public static void getAllFileDescriptors(DescriptorProtos.FileDescriptorSet set, Map<String, Set<Descriptors.FileDescriptor>> dependenciesMap, Map<String, Descriptors.FileDescriptor> fileDescriptorMap) throws StageException { List<DescriptorProtos.FileDescriptorProto> fileList = set.getFileList(); try { for (DescriptorProtos.FileDescriptorProto fdp : fileList) { if (!fileDescriptorMap.containsKey(fdp.getName())) { Set<Descriptors.FileDescriptor> dependencies = dependenciesMap.get(fdp.getName()); if (dependencies == null) { dependencies = new LinkedHashSet<>(); dependenciesMap.put(fdp.getName(), dependencies); dependencies.addAll(getDependencies(dependenciesMap, fileDescriptorMap, fdp, set)); } Descriptors.FileDescriptor fileDescriptor = Descriptors.FileDescriptor.buildFrom(fdp, dependencies.toArray(new Descriptors.FileDescriptor[dependencies.size()])); fileDescriptorMap.put(fdp.getName(), fileDescriptor); } } } catch (Descriptors.DescriptorValidationException e) { throw new StageException(Errors.PROTOBUF_07, e.getDescription(), e); } }
From source file:hoot.services.osm.OsmTestUtils.java
public static Set<Long> createTestWays(final long changesetId, final Set<Long> nodeIds) throws Exception { Set<Long> wayIds = new LinkedHashSet<Long>(); List<Long> wayNodeIds = new ArrayList<Long>(); final Long[] nodeIdsArr = nodeIds.toArray(new Long[] {}); Map<String, String> tags = new HashMap<String, String>(); tags.put("key 1", "val 1"); tags.put("key 2", "val 2"); wayNodeIds.add(nodeIdsArr[0]);//w w w. j a v a 2s . c o m wayNodeIds.add(nodeIdsArr[1]); wayNodeIds.add(nodeIdsArr[4]); wayIds.add(Way.insertNew(changesetId, mapId, wayNodeIds, tags, conn)); tags.clear(); wayNodeIds.clear(); wayNodeIds.add(nodeIdsArr[2]); wayNodeIds.add(nodeIdsArr[1]); wayIds.add(Way.insertNew(changesetId, mapId, wayNodeIds, null, conn)); wayNodeIds.clear(); tags.put("key 3", "val 3"); wayNodeIds.add(nodeIdsArr[0]); wayNodeIds.add(nodeIdsArr[1]); wayIds.add(Way.insertNew(changesetId, mapId, wayNodeIds, tags, conn)); tags.clear(); wayNodeIds.clear(); return wayIds; }
From source file:com.acciente.commons.loader.JavaCompiledClassDef.java
private void readReferencedClasses(byte[] ayClassByteCode, String sFilename) throws IOException { Set oReferencedClassNameSet = new ClassFile(ayClassByteCode).getReferencedClasses(); // convert the list to an array _asReferencedClassNames = new String[oReferencedClassNameSet.size()]; oReferencedClassNameSet.toArray(_asReferencedClassNames); }
From source file:com.nesscomputing.log.jmx.Log4JMBean.java
@Managed public String[] getLoggerNames() { final Set<String> mbeans = levelMBeans.keySet(); return mbeans.toArray(new String[mbeans.size()]); }