本文整理汇总了Java中java.util.ArrayDeque.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayDeque.addAll方法的具体用法?Java ArrayDeque.addAll怎么用?Java ArrayDeque.addAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.ArrayDeque
的用法示例。
在下文中一共展示了ArrayDeque.addAll方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stopWhileSize
import java.util.ArrayDeque; //导入方法依赖的package包/类
private static void stopWhileSize(ArrayDeque<PerformanceNode> d, ThreadPerformance threadPerformance) {
int s = d.size();
while (s > 0) {
PerformanceNode n = d.getFirst();
if (n.end == 0) {
n.end = System.nanoTime() - startTime;
threadPerformance.active.remove(n);
d.addAll(n.children);
s = d.size();
}
}
}
示例2: extendClass
import java.util.ArrayDeque; //导入方法依赖的package包/类
public static Class extendClass(Class<?> extend, final LuaTable delegations, Class<?>... inherit) {
long startTime = System.nanoTime();
ArrayDeque<Class> toCheck = new ArrayDeque<Class>();
toCheck.add(extend);
toCheck.addAll(Arrays.asList(inherit));
extendClassWhile(toCheck, delegations);
try {
ReceiverTypeDefinition<?> build = b.subclass(extend).implement(inherit)
.method(not(isConstructor()).and(isAbstract()))
.intercept(MethodDelegation.to(new AbstractInterceptor(delegations)));
if (!delegations.get("__new__").isnil()) {
build = build.constructor(isConstructor()).intercept(
SuperMethodCall.INSTANCE.andThen(MethodDelegation.to(new ConstructorInterceptor(delegations))));
}
Junction<MethodDescription> publicMethods = not(isConstructor().or(isAbstract())).and(isPublic())
.and(new ElementMatcher<MethodDescription>() {
@Override
public boolean matches(MethodDescription target) {
return !delegations.get(target.getName()).isnil();
}
});
build = build.method(publicMethods).intercept(MethodDelegation.to(new PublicInterceptor(delegations)));
Unloaded unloaded = build.make();
Loaded loaded = Compatibility.get().load(unloaded);
Class c = loaded.getLoaded();
Log.debug("Created dynamic class " + c.getName() + " in " + ((System.nanoTime() - startTime) / 1000000)
+ "ms");
return c;
} catch (Exception e) {
Log.error("Failed to create dynamic class " + extend.getName() + " " + Arrays.toString(inherit));
throw new CubesException("Failed to make dynamic class", e);
}
}
示例3: stop
import java.util.ArrayDeque; //导入方法依赖的package包/类
public static void stop(String tag) {
if (!enabled.get()) return;
ThreadPerformance threadPerformance = threadNode.get();
synchronized (threadPerformance) {
PerformanceNode last = threadPerformance.active.getLast();
if (last.tag.equals(tag) && !(last instanceof ThreadPerformance)) {
last.end = System.nanoTime() - startTime;
threadPerformance.active.remove(last);
} else {
Log.error("Performance: stopping tag '" + tag + "' when the last tag is '" + last.tag + "'");
PerformanceNode node = null;
for (PerformanceNode performanceNode : threadPerformance.active) {
if (performanceNode.tag.equals(tag)) {
node = performanceNode;
break;
}
}
if (node == null) {
Log.error("Performance: tag '" + tag + "' was never started");
return;
}
ArrayDeque<PerformanceNode> d = new ArrayDeque<PerformanceNode>();
d.add(node);
while (d.size() > 0) {
PerformanceNode n = d.getFirst();
if (n.end == 0) {
n.end = System.nanoTime() - startTime;
threadPerformance.active.remove(n);
d.addAll(n.children);
}
}
}
}
}
示例4: testAddAll1
import java.util.ArrayDeque; //导入方法依赖的package包/类
/**
* addAll(null) throws NPE
*/
public void testAddAll1() {
ArrayDeque q = new ArrayDeque();
try {
q.addAll(null);
shouldThrow();
} catch (NullPointerException success) {}
}
示例5: testAddAll2
import java.util.ArrayDeque; //导入方法依赖的package包/类
/**
* addAll of a collection with null elements throws NPE
*/
public void testAddAll2() {
ArrayDeque q = new ArrayDeque();
try {
q.addAll(Arrays.asList(new Integer[SIZE]));
shouldThrow();
} catch (NullPointerException success) {}
}
示例6: testAddAll3
import java.util.ArrayDeque; //导入方法依赖的package包/类
/**
* addAll of a collection with any null elements throws NPE after
* possibly adding some elements
*/
public void testAddAll3() {
ArrayDeque q = new ArrayDeque();
Integer[] ints = new Integer[SIZE];
for (int i = 0; i < SIZE - 1; ++i)
ints[i] = new Integer(i);
try {
q.addAll(Arrays.asList(ints));
shouldThrow();
} catch (NullPointerException success) {}
}
示例7: extendClass
import java.util.ArrayDeque; //导入方法依赖的package包/类
public static Class extendClass(Class<?> extend, final LuaTable delegations, Class<?>... inherit) {
long startTime = System.nanoTime();
ArrayDeque<Class> toCheck = new ArrayDeque<Class>();
toCheck.add(extend);
toCheck.addAll(Arrays.asList(inherit));
while (!toCheck.isEmpty()) {
Class check = toCheck.pop();
for (Method method : check.getDeclaredMethods()) {
if (Modifier.isAbstract(method.getModifiers())) {
if (delegations.get(method.getName()).isnil())
throw new DynamicDelegationError("No delegation for abstract method " + method);
}
}
check = check.getSuperclass();
if (check != null && check != Object.class) toCheck.add(check);
}
try {
ReceiverTypeDefinition<?> build = b.subclass(extend).implement(inherit)
.method(not(isConstructor()).and(isAbstract())).intercept(MethodDelegation.to(new AbstractInterceptor(delegations)));
if (!delegations.get("__new__").isnil()) {
build = build.constructor(isConstructor()).intercept(SuperMethodCall.INSTANCE.andThen(MethodDelegation.to(new ConstructorInterceptor(delegations))));
}
Junction<MethodDescription> publicMethods = not(isConstructor().or(isAbstract())).and(isPublic()).and(new ElementMatcher<MethodDescription>() {
@Override
public boolean matches(MethodDescription target) {
return !delegations.get(target.getName()).isnil();
}
});
build = build.method(publicMethods).intercept(MethodDelegation.to(new PublicInterceptor(delegations)));
Unloaded unloaded = build.make();
Loaded loaded = Compatibility.get().load(unloaded);
Class c = loaded.getLoaded();
Log.debug("Created dynamic class " + c.getName() + " in " + ((System.nanoTime() - startTime) / 1000000) + "ms");
return c;
} catch (Exception e) {
Log.error("Failed to create dynamic class " + extend.getName() + " " + Arrays.toString(inherit));
throw new CubesException("Failed to make dynamic class", e);
}
}