List of usage examples for org.apache.commons.collections ArrayStack isEmpty
public boolean isEmpty()
From source file:org.apache.cocoon.el.impl.objectmodel.ObjectModelImpl.java
public void cleanupLocalContext() { if (localContexts.empty()) { throw new IllegalStateException("Local contexts stack is empty"); }//from w ww. java2s . c o m ArrayStack removeEntries = (ArrayStack) localContexts.pop(); while (!removeEntries.isEmpty()) { if (removeEntries.peek() instanceof PathValue) { PathValue entry = (PathValue) removeEntries.pop(); removeAt(entry.getPath(), entry.getValue()); } else { KeyValue entry = (KeyValue) removeEntries.pop(); Object key = entry.getKey(); Object value = entry.getValue(); multiValueMap.remove(key, value); if (multiValueMap.containsKey(key)) { singleValueMap.put(key, ((StackReversedIteration) multiValueMap.get(key)).peek()); } else { singleValueMap.remove(key); } } } }
From source file:org.apache.jmeter.services.FileServer.java
/** * Calculates the relative path from {@link #DEFAULT_BASE} to the current base, * which must be the same as or a child of the default. * /*from ww w .j a va 2 s .c om*/ * @return the relative path, or {@code "."} if the path cannot be determined */ public synchronized File getBaseDirRelative() { // Must first convert to absolute path names to ensure parents are available File parent = new File(DEFAULT_BASE).getAbsoluteFile(); File f = base.getAbsoluteFile(); ArrayStack l = new ArrayStack(); while (f != null) { if (f.equals(parent)) { if (l.isEmpty()) { break; } File rel = new File((String) l.pop()); while (!l.isEmpty()) { rel = new File(rel, (String) l.pop()); } return rel; } l.push(f.getName()); f = f.getParentFile(); } return new File("."); }