Tabnine Logo
ArrayList.forEach
Code IndexAdd Tabnine to your IDE (free)

How to use
forEach
method
in
java.util.ArrayList

Best Java code snippets using java.util.ArrayList.forEach (Showing top 20 results out of 2,088)

origin: apache/incubator-druid

 void free()
 {
  open = false;
  buffers.forEach(ByteBufferUtils::free);
  buffers.clear();
  headBufferIndex = -1;
  headBuffer = null;
  size = 0;
  capacity = 0;
 }
}
origin: real-logic/aeron

public void onClose()
{
  publicationImages.forEach(PublicationImage::free);
  networkPublications.forEach(NetworkPublication::free);
  ipcPublications.forEach(IpcPublication::free);
  ctx.close();
}
origin: SonarSource/sonarqube

private static Map<String, String> getHeaders(HttpServletRequest request) {
 Map<String, String> headers = new HashMap<>();
 Collections.list(request.getHeaderNames()).forEach(header -> headers.put(header.toLowerCase(Locale.ENGLISH), request.getHeader(header)));
 return headers;
}
origin: stackoverflow.com

public void timeForEachAnonymousClass(int reps){
  for (int i = 0; i < reps; i++) {
    list.forEach(new Consumer<TestObject>() {
      @Override
      public void accept(TestObject t) {
public void timeForEachLambda(int reps){
  for (int i = 0; i < reps; i++) {
    list.forEach(t -> t.result++);
origin: SonarSource/sonarqube

 public void executeRecorded() {
  ArrayList<Runnable> runnables = new ArrayList<>(runnableList);
  runnableList.clear();
  runnables.forEach(Runnable::run);
 }
}
origin: jooby-project/jooby

/**
 * Read a svg file and return the svg element (original) and a new symbol element (created from
 * original).
 *
 * @param file Svg file.
 * @param id   ID to use.
 * @return Svg element (original) and a symbol element (converted).
 * @throws IOException If something goes wrong.
 */
private Tuple<Element, Element> symbol(final Path file, final String id) throws IOException {
 Element svg = Jsoup.parse(file.toFile(), "UTF-8").select("svg").first();
 Element symbol = new Element(Tag.valueOf("symbol"), "")
   .attr("id", id)
   .attr("viewBox", svg.attr("viewBox"));
 new ArrayList<>(svg.childNodes()).forEach(symbol::appendChild);
 return new Tuple(svg, symbol);
}
origin: eclipse-vertx/vert.x

new ArrayList<>(namedWorkerPools.values()).forEach(WorkerPool::close);
origin: apache/ignite

/** {@inheritDoc} */
@Override public void onLocalJoin(DiscoveryEvent evt, DiscoCache discoCache) {
  assert ctx.localNodeId().equals(evt.eventNode().id());
  assert evt.type() == EVT_NODE_JOINED;
  if (isLocalNodeCoordinator()) {
    // First node start, method onGridDataReceived(DiscoveryDataBag.GridDiscoveryData) has not been called.
    ArrayList<ServiceInfo> staticServicesInfo = staticallyConfiguredServices(false);
    staticServicesInfo.forEach(desc -> registeredServices.put(desc.serviceId(), desc));
  }
  ServiceDeploymentActions depActions = null;
  if (!registeredServices.isEmpty()) {
    depActions = new ServiceDeploymentActions();
    depActions.servicesToDeploy(new HashMap<>(registeredServices));
  }
  depMgr.onLocalJoin(evt, discoCache, depActions);
}
origin: stanfordnlp/CoreNLP

private static void addLemmata(Tree tree) {
 tree.yield().forEach(l -> {
  CoreLabel w = (CoreLabel) l;
  if(w.lemma() == null) {
   w.setLemma(MORPH.lemma(w.word(), w.tag()));
  }
 });
}
origin: org.apache.ant/ant

    classpathAttribute.setName(ATTRIBUTE_CLASSPATH);
  Collections.list(attribute.getValues()).forEach(classpathAttribute::addValue);
} else {
  Attribute currentCp = getAttribute(ATTRIBUTE_CLASSPATH);
  if (currentCp != null) {
    Collections.list(currentCp.getValues()).forEach(classpathAttribute::addValue);
origin: org.apache.ant/ant

private void executeLocal() {
  try {
    inetAddrs = new LinkedList<>();
    Collections.list(NetworkInterface.getNetworkInterfaces())
        .forEach(netInterface -> inetAddrs.addAll(Collections.list(netInterface.getInetAddresses())));
    selectAddresses();
    if (nameAddr != null && hasHostName(nameAddr)) {
      setDomainAndName(nameAddr.getCanonicalHostName());
    } else {
      setProperty(DOMAIN, DEF_DOMAIN);
      setProperty(NAME, DEF_LOCAL_NAME);
    }
    if (best4 != null) {
      setProperty(ADDR4, best4.getHostAddress());
    } else {
      setProperty(ADDR4, DEF_LOCAL_ADDR4);
    }
    if (best6 != null) {
      setProperty(ADDR6, best6.getHostAddress());
    } else {
      setProperty(ADDR6, DEF_LOCAL_ADDR6);
    }
  } catch (Exception e) {
    log("Error retrieving local host information", e, Project.MSG_WARN);
    setProperty(DOMAIN, DEF_DOMAIN);
    setProperty(NAME, DEF_LOCAL_NAME);
    setProperty(ADDR4, DEF_LOCAL_ADDR4);
    setProperty(ADDR6, DEF_LOCAL_ADDR6);
  }
}
origin: org.apache.ant/ant

warnings.add(
  "Multiple Class-Path attributes are supported but violate the Jar specification and may not be correctly processed in all environments");
Collections.list(attribute.getValues()).forEach(classpathAttribute::addValue);
origin: org.apache.poi/poi-ooxml

/**
 * Remove the specified shape from this group
 */
@Override
public boolean removeShape(XSLFShape xShape) {
  XmlObject obj = xShape.getXmlObject();
  CTGroupShape grpSp = (CTGroupShape)getXmlObject();
  getSheet().deregisterShapeId(xShape.getShapeId());
  if(obj instanceof CTShape){
    grpSp.getSpList().remove(obj);
  } else if (obj instanceof CTGroupShape){
    XSLFGroupShape gs = (XSLFGroupShape)xShape;
    new ArrayList<>(gs.getShapes()).forEach(gs::removeShape);
    grpSp.getGrpSpList().remove(obj);
  } else if (obj instanceof CTConnector){
    grpSp.getCxnSpList().remove(obj);
  } else if (obj instanceof CTGraphicalObjectFrame) {
    grpSp.getGraphicFrameList().remove(obj);
  } else if (obj instanceof CTPicture) {
    XSLFPictureShape ps = (XSLFPictureShape)xShape;
    XSLFSheet sh = getSheet();
    if (sh != null) {
      sh.removePictureRelation(ps);
    }
    grpSp.getPicList().remove(obj);
  } else {
    throw new IllegalArgumentException("Unsupported shape: " + xShape);
  }
  return _shapes.remove(xShape);
}
origin: org.apache.poi/poi-ooxml

} else if (obj instanceof CTGroupShape) {
  XSLFGroupShape gs = (XSLFGroupShape)xShape;
  new ArrayList<>(gs.getShapes()).forEach(gs::removeShape);
  spTree.getGrpSpList().remove(obj);
} else if (obj instanceof CTConnector) {
origin: eclipse-vertx/vert.x

@Test
public void testHttpClientMetricsQueueClose() throws Exception {
 server = vertx.createHttpServer();
 List<Runnable> requests = Collections.synchronizedList(new ArrayList<>());
 server.requestHandler(req -> {
  requests.add(() -> {
   vertx.runOnContext(v -> {
    req.connection().close();
   });
  });
 });
 CountDownLatch listenLatch = new CountDownLatch(1);
 server.listen(8080, "localhost", onSuccess(s -> { listenLatch.countDown(); }));
 awaitLatch(listenLatch);
 client = vertx.createHttpClient();
 FakeHttpClientMetrics metrics = FakeHttpClientMetrics.getMetrics(client);
 for (int i = 0;i < 5;i++) {
  client.getNow(8080, "localhost", "/somepath", resp -> {
  });
 }
 assertWaitUntil(() -> requests.size() == 5);
 EndpointMetric endpoint = metrics.endpoint("localhost:8080");
 assertEquals(5, endpoint.connectionCount.get());
 ArrayList<Runnable> copy = new ArrayList<>(requests);
 requests.clear();
 copy.forEach(Runnable::run);
 assertWaitUntil(() -> metrics.endpoints().isEmpty());
 assertEquals(0, endpoint.connectionCount.get());
}
origin: org.apache.ant/ant

/**
 * Get a description handler.
 * @param srcDir the source directory.
 * @return the handler.
 */
protected DescriptorHandler getWebsphereDescriptorHandler(final File srcDir) {
  DescriptorHandler handler =
    new DescriptorHandler(getTask(), srcDir) {
      @Override
      protected void processElement() {
      }
    };
  getConfig().dtdLocations.forEach(l -> handler.registerDTD(l.getPublicId(), l.getLocation()));
  return handler;
}
origin: org.apache.ant/ant

/** {@inheritDoc}. */
@Override
protected DescriptorHandler getDescriptorHandler(File srcDir) {
  DescriptorHandler handler = new DescriptorHandler(getTask(), srcDir);
  // register all the DTDs, both the ones that are known and
  // any supplied by the user
  handler.registerDTD(PUBLICID_EJB11, ejb11DTD);
  getConfig().dtdLocations.forEach(l -> handler.registerDTD(l.getPublicId(), l.getLocation()));
  return handler;
}
origin: eclipse-vertx/vert.x

vertx.setTimer(300, v -> {
 assertEquals(maxRequests, requests.size());
 requests.forEach(r -> r.response().end());
});
origin: eclipse-vertx/vert.x

ArrayList<Runnable> copy = new ArrayList<>(requests);
requests.clear();
copy.forEach(Runnable::run);
awaitLatch(responsesLatch);
assertWaitUntil(() -> requests.size() == 5);
copy = new ArrayList<>(requests);
requests.clear();
copy.forEach(Runnable::run);
assertWaitUntil(() -> requests.size() == 3);
assertEquals(Collections.singleton("localhost:8080"), metrics.endpoints());
origin: org.apache.ant/ant

handler.registerDTD(PUBLICID_WEBLOGIC_EJB600, weblogicDTD);
getConfig().dtdLocations.forEach(l -> handler.registerDTD(l.getPublicId(), l.getLocation()));
return handler;
java.utilArrayListforEach

Popular methods of ArrayList

  • <init>
  • add
  • size
    Returns the number of elements in this ArrayList.
  • get
    Returns the element at the specified position in this list.
  • toArray
    Returns an array containing all of the elements in this list in proper sequence (from first to last
  • addAll
    Adds the objects in the specified collection to this ArrayList.
  • remove
    Removes the first occurrence of the specified element from this list, if it is present. If the list
  • clear
    Removes all elements from this ArrayList, leaving it empty.
  • isEmpty
    Returns true if this list contains no elements.
  • iterator
    Returns an iterator over the elements in this list in proper sequence.The returned iterator is fail-
  • contains
    Searches this ArrayList for the specified object.
  • set
    Replaces the element at the specified position in this list with the specified element.
  • contains,
  • set,
  • indexOf,
  • clone,
  • subList,
  • stream,
  • ensureCapacity,
  • trimToSize,
  • removeAll,
  • toString

Popular in Java

  • Start an intent from android
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getExternalFilesDir (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now