Java Code Examples for java.util.Collections.enumeration()

The following are Jave code examples for showing how to use enumeration() of the java.util.Collections class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: convertigo-engine   File: StepWithExpressions.java   View Source Code Vote up 6 votes
protected void cleanChildren() {
	if (childrenSteps != null) {
		//Enumeration e = childrenSteps.elements();
		Enumeration<String> e = Collections.enumeration(childrenSteps.keySet());
		while (e.hasMoreElements()) {
			String timeID = (String)e.nextElement();
			if (timeID != null) {
				Long stepPriority = null;
				Step step = sequence.getCopy(timeID);
				if (step != null) {
					stepPriority = new Long(step.priority);
					step.cleanCopy();
				}
				sequence.removeCopy(timeID, stepPriority);
			}
		}
		childrenSteps.clear();
	}
}
 
Example 2
Project: treasure   File: ByteArrayOutputStream.java   View Source Code Vote up 6 votes
/**
 * Gets the current contents of this byte stream as a Input Stream. The
 * returned stream is backed by buffers of <code>this</code> stream,
 * avoiding memory allocation and copy, thus saving space and time.<br>
 * 
 * @return the current contents of this output stream.
 * @see java.io.ByteArrayOutputStream#toByteArray()
 * @see #reset()
 * @since 2.0
 */
private InputStream toBufferedInputStream() {
    int remaining = count;
    if (remaining == 0) {
        return new ClosedInputStream();
    }
    List<ByteArrayInputStream> list = new ArrayList<ByteArrayInputStream>(buffers.size());
    for (byte[] buf : buffers) {
        int c = Math.min(buf.length, remaining);
        list.add(new ByteArrayInputStream(buf, 0, c));
        remaining -= c;
        if (remaining == 0) {
            break;
        }
    }
    return new SequenceInputStream(Collections.enumeration(list));
}
 
Example 3
Project: openjdk-jdk10   File: NamespaceSupport.java   View Source Code Vote up 5 votes
/**
 * Return an enumeration of prefixes declared in this context.
 *
 * @return An enumeration of prefixes (possibly empty).
 * @see org.xml.sax.helpers.NamespaceSupport#getDeclaredPrefixes
 */
Enumeration getDeclaredPrefixes ()
{
    if (declarations == null) {
        return EMPTY_ENUMERATION;
    } else {
        return Collections.enumeration(declarations);
    }
}
 
Example 4
Project: myfaces-trinidad   File: FileUploadConfiguratorImpl.java   View Source Code Vote up 5 votes
public InputStream getInputStream() throws IOException
{
  List<InputStream> inputSteamList = new ArrayList<InputStream>(_uploadedFileChunkList.size());
  for (UploadedFile uploadedFileChunk : _uploadedFileChunkList)
    inputSteamList.add(uploadedFileChunk.getInputStream());
  
  return new SequenceInputStream(Collections.enumeration(inputSteamList));
}
 
Example 5
Project: OperatieBRP   File: SteekproefServiceImpl.java   View Source Code Vote up 5 votes
private static SequenceInputStream maakLogischBestand(final List<Path> paths) {
    final List<InputStream> inputStreamList = Lists.newArrayList();
    for (Path path : paths) {
        try {
            final FileInputStream fileInputStream = new FileInputStream(path.toFile());
            inputStreamList.add(fileInputStream);
        } catch (FileNotFoundException e) {
            inputStreamList.forEach(IOUtils::closeQuietly);
            throw new IllegalStateException(e);

        }
    }
    return new SequenceInputStream(Collections.enumeration(inputStreamList));
}
 
Example 6
Project: incubator-netbeans   File: MavenQueryProvider.java   View Source Code Vote up 5 votes
@Override
public Enumeration enabled(GrammarEnvironment ctx) {
    // check if is supported environment..
    if (getGrammar(ctx) != null) {
        Enumeration en = ctx.getDocumentChildren();
        while (en.hasMoreElements()) {
            Node next = (Node)en.nextElement();
            if (next.getNodeType() == Node.ELEMENT_NODE) {
                return Collections.enumeration(Collections.singletonList(next));
            }
        }
    }
    return null;
}
 
Example 7
Project: lazycat   File: ReplicatedContext.java   View Source Code Vote up 5 votes
@SuppressWarnings("unchecked")
@Override
public Enumeration<String> getAttributeNames() {
	Set<String> names = new HashSet<String>();
	names.addAll(attributes.keySet());

	return new MultiEnumeration<String>(
			new Enumeration[] { super.getAttributeNames(), Collections.enumeration(names) });
}
 
Example 8
Project: OpenJSharp   File: ParallelListResourceBundle.java   View Source Code Vote up 4 votes
@Override
public Enumeration<String> getKeys() {
    return Collections.enumeration(keySet());
}
 
Example 9
Project: holon-core   File: TestHttpRequest.java   View Source Code Vote up 4 votes
private static Enumeration<String> buildHeaderAccept() {
	return Collections.enumeration(Arrays.asList("application/json"));
}
 
Example 10
Project: jdk8u-jdk   File: ParallelListResourceBundle.java   View Source Code Vote up 4 votes
@Override
public Enumeration<String> getKeys() {
    return Collections.enumeration(keySet());
}
 
Example 11
Project: incubator-netbeans   File: DocumentElement.java   View Source Code Vote up 4 votes
public Enumeration<String> getAttributeNames() {
    return Collections.enumeration(keys());
}
 
Example 12
Project: convertigo-eclipse   File: DatabaseObjectIncreasePriorityAction.java   View Source Code Vote up 4 votes
public void run() {
	Display display = Display.getDefault();
	Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);		
	
	Shell shell = getParentShell();
	shell.setCursor(waitCursor);
	
       try {
       	treeNodesToUpdate = new ArrayList<TreeParent>();
       	
   		ProjectExplorerView explorerView = getProjectExplorerView();
   		if (explorerView != null) {
   			TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
   			String[] selectedPaths = new String[treeObjects.length];
   			if (treeObjects != null) {
   				// Increase priority
   				TreeObject treeObject = null;
   				for (int i = 0 ; i < treeObjects.length ; i++) {
   					treeObject = treeObjects[i];
   					selectedPaths[i] = treeObject.getPath();
  						increasePriority(treeObject);
   				}
   				
   				// Updating the tree and the properties panel
   				Enumeration<TreeParent> enumeration = Collections.enumeration(treeNodesToUpdate);
   				TreeParent parentTreeObject = null;
   				while (enumeration.hasMoreElements()) {
   					parentTreeObject = enumeration.nextElement();
   					explorerView.reloadTreeObject(parentTreeObject);
   				}
   				
   				// Restore selection
   	    		TreeObjectEvent treeObjectEvent;
   	        	for (int i=0; i<selectedPaths.length; i++) {
   	        		String previousPath = selectedPaths[i];
   	        		treeObject = explorerView.findTreeObjectByPath(parentTreeObject, previousPath);
   	        		if (treeObject != null) {
   	        			treeObjects[i] = treeObject;
   		                treeObjectEvent = new TreeObjectEvent(treeObject);
   		                explorerView.fireTreeObjectPropertyChanged(treeObjectEvent);
   	        		}
   	        	}
   				explorerView.setSelectedTreeObjects(treeObjects);
   			}
   		}
       }
       catch (Throwable e) {
       	ConvertigoPlugin.logException(e, "Unable to increase priority!");
       }
       finally {
		shell.setCursor(null);
		waitCursor.dispose();
       }
}
 
Example 13
Project: validator-web   File: FakeServletConfig.java   View Source Code Vote up 4 votes
@Override
public Enumeration<String> getInitParameterNames() {
    return Collections.enumeration(initParameters.keySet());
}
 
Example 14
Project: VASSAL-src   File: AbstractBuildable.java   View Source Code Vote up 4 votes
/**
 * @return all build components that are an instance of the given class
 * @deprecated Use {@link #getComponentsOf(Class<T>)} instead.
 */
@Deprecated
public <T> Enumeration<T> getComponents(Class<T> target) {
  return Collections.enumeration(getComponentsOf(target));
}
 
Example 15
Project: VASSAL-src   File: Map.java   View Source Code Vote up 4 votes
/**
 * @return an Enumeration of all {@link Board}s on the map
 * @deprecated Use {@link #getBoards()} instead.
 */
@Deprecated
public Enumeration<Board> getAllBoards() {
  return Collections.enumeration(boards);
}
 
Example 16
Project: incubator-netbeans   File: InstantRenamePerformerTest.java   View Source Code Vote up 4 votes
protected Enumeration<? extends DataLoader> loaders() {
    return Collections.enumeration(result.allInstances());
}
 
Example 17
Project: incubator-netbeans   File: AttributesUtilities.java   View Source Code Vote up 4 votes
@Override
public Enumeration<?> getAttributeNames() {
    return Collections.enumeration(getAllKeys());
}
 
Example 18
Project: convertigo-engine   File: InternalHttpServletRequest.java   View Source Code Vote up 4 votes
@Override
public Enumeration<Locale> getLocales() {
	return Collections.enumeration(Arrays.asList(getLocale()));
}
 
Example 19
Project: mi-firma-android   File: DnieKeyStoreImpl.java   View Source Code Vote up 4 votes
/** {@inheritDoc} */
@Override
public Enumeration<String> engineAliases() {
    return Collections.enumeration(this.aliases);
}
 
Example 20
Project: NotifyTools   File: FeatureDescriptor.java   View Source Code Vote up 2 votes
/**
 * <p>
 * Enumerates the attribute names.
 * </p>
 * 
 * @return An instance of {@link Enumeration}.
 */
public Enumeration<String> attributeNames() {
    // Create a new list, so that the references are copied
    return Collections.enumeration(new LinkedList<String>(values.keySet()));
}