use of java.util.EmptyStackException in project CtCI-6th-Edition by careercup.
the class Stack method pop.
public int pop() {
if (top == null)
throw new EmptyStackException();
Node t = top;
top = top.below;
size--;
return t.value;
}
use of java.util.EmptyStackException in project CtCI-6th-Edition by careercup.
the class SetOfStacks method pop.
public int pop() {
Stack last = getLastStack();
if (last == null)
throw new EmptyStackException();
int v = last.pop();
if (last.size == 0) {
stacks.remove(stacks.size() - 1);
}
return v;
}
use of java.util.EmptyStackException in project cosmic by MissionCriticalCloud.
the class DefaultModuleDefinitionSet method startContexts.
protected void startContexts() {
withModule((def, parents) -> {
try {
final ApplicationContext context = getApplicationContext(def.getName());
try {
final Runnable runnable = context.getBean("moduleStartup", Runnable.class);
log.info("Starting module [{}]", def.getName());
runnable.run();
} catch (final BeansException e) {
log.warn("Ignore", e);
}
} catch (final EmptyStackException e) {
log.warn("The root context is already loaded, so ignore the exception", e);
}
});
}
use of java.util.EmptyStackException in project cosmic by MissionCriticalCloud.
the class DefaultModuleDefinitionSet method loadContexts.
protected void loadContexts() {
withModule((def, parents) -> {
try {
final String applicationContextName = parents.peek().getName();
log.debug("Loading application context: " + applicationContextName);
final ApplicationContext parent = getApplicationContext(applicationContextName);
loadContext(def, parent);
} catch (final EmptyStackException e) {
log.warn("The root context is already loaded, so ignore the exception", e);
}
});
}
use of java.util.EmptyStackException in project robovm by robovm.
the class NamespaceSupportTest method testReset.
public void testReset() {
int count;
ns = new NamespaceSupport();
count = countPrefixes();
ns.pushContext();
ns.declarePrefix("dc", "http://www.purl.org/dc#");
assertEquals("Test 1: Incorrect prefix count;", count + 1, countPrefixes());
ns.reset();
assertEquals("Test 2: Incorrect prefix count;", count, countPrefixes());
// Check that only one context has been created by reset().
try {
ns.popContext();
fail("Test 3: EmptyStackException expected.");
} catch (EmptyStackException e) {
// Expected.
}
}
Aggregations