当前位置: 首页>>代码示例>>Java>>正文


Java ArrayDeque.addAll方法代码示例

本文整理汇总了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();
		}
	}
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:13,代码来源:Performance.java

示例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);
	}
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:37,代码来源:LuaGeneration.java

示例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);
        }
      }
    }
  }
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:35,代码来源:Performance.java

示例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) {}
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:ArrayDequeTest.java

示例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) {}
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:ArrayDequeTest.java

示例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) {}
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:ArrayDequeTest.java

示例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);
  }
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:43,代码来源:LuaGeneration.java


注:本文中的java.util.ArrayDeque.addAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。