APISonar


java.util.ArrayList.forEach

> java > util > ArrayList > forEach
java APIs util APIs ArrayList APIs forEach APIs

Example 1
protected ArrayList<T> collectionTargets;

  public void collectAndApply() {
    collect();
    lastingTargets.forEach( target -> apply(target) );
    collectionTargets.forEach( target -> apply(target) );
    collectionTargets.clear();
  }
Example 2
private final ArrayList<T> sessions = new ArrayList<>();

    public final void onClose()
    {
        if (isClosed)
        {
            return;
        }

        isClosed = true;

        preSessionsClose();
        sessions.forEach(this::closeSession);
        sessions.clear();
        postSessionsClose();
    }
Example 3
private void notifyChanged() {
    ArrayList<Listener> copy;
    synchronized (myListeners) {
      if (myListeners.isEmpty()) {
        return;
      }
      copy = new ArrayList<>(myListeners);
    }
    copy.forEach(Listener::settingsChanged);
  }
Example 4
ArrayList<Object> arrayList;

  int arrayListForEachWithHolder(int reps) {
    int[] sumHolder = {0};
    for (int i = 0; i < reps; i++) {
      arrayList.forEach(value -> sumHolder[0] += value.hashCode());
    }
    return sumHolder[0];
  }
Example 5
private static final ArrayList<String> logList = new ArrayList<>();

    private static void printLog() {
        logList.forEach(System.out::println);
        logList.clear();
    }
Example 6
public void close() {
        synchronized (this.lock) {
            if (this.closed) {
                return;
            }

            this.closed = true;

            // Cancel all pending reads and unregister them.
            ArrayList<Request> toClose = new ArrayList<>(this.pendingRequests.values());
            toClose.forEach(Request::cancel);
        }
    }
Example 7
private final ArrayList<Callback> mCallbacks = new ArrayList<Callback>();

    public void notifyKeyguardFadingAway(long delay, long fadeoutDuration) {
        mKeyguardFadingAway = true;
        mKeyguardFadingAwayDelay = delay;
        mKeyguardFadingAwayDuration = fadeoutDuration;
        mCallbacks.forEach(Callback::onKeyguardShowingChanged);
    }
Example 8
private final ArrayList<ManagedResource> lingeringResources = new ArrayList<>();

    public synchronized void onClose()
    {
        activePublications.close();
        activeSubscriptions.close();

        Thread.yield();

        lingeringResources.forEach(ManagedResource::delete);
    }
Example 9
private final ArrayList<NetworkPublication> networkPublications = new ArrayList<>();

    public void onClose()
    {
        networkPublications.forEach(NetworkPublication::close);
        publicationImages.forEach(PublicationImage::close);
        ipcPublications.forEach(IpcPublication::close);
    }
Example 10
private static final ArrayList<CountDownLatch> LATCHES = new ArrayList<>();

    public void signalAll()
    {
        synchronized (LATCHES)
        {
            LATCHES.forEach(CountDownLatch::countDown);
            LATCHES.clear();
        }
    }
Example 11
private ArrayList<ActionListener> mListeners = new ArrayList<>();

    private void notifyActionsChanged() {
        if (!mListeners.isEmpty()) {
            List<RemoteAction> actions = getMediaActions();
            mListeners.forEach(l -> l.onMediaActionsChanged(actions));
        }
    }
Example 12
private void print(Map<String, NextObjective> nextStore) {
        ArrayList<String> a = new ArrayList<>(nextStore.keySet());
        a.sort(Comparator.comparing((String o) -> o));

        StringBuilder builder = new StringBuilder();
        a.forEach(k ->
            builder.append("\n")
                    .append(k)
                    .append(" --> ")
                    .append(nextStore.get(k).id())
        );
        print(builder.toString());
    }
Example 13
private void print(Map<PortNextObjectiveStoreKey, Integer> portNextObjStore) {
        ArrayList<PortNextObjectiveStoreKey> a = new ArrayList<>(portNextObjStore.keySet());
        a.sort(Comparator
                .comparing((PortNextObjectiveStoreKey o) -> o.deviceId().toString())
                .thenComparing((PortNextObjectiveStoreKey o) -> o.portNumber().toLong()));

        StringBuilder builder = new StringBuilder();
        a.forEach(k ->
            builder.append("\n")
                    .append(k)
                    .append(" --> ")
                    .append(portNextObjStore.get(k))
        );
        print(builder.toString());
    }
Example 14
private void print(Map<VlanNextObjectiveStoreKey, Integer> vlanNextObjStore) {
        ArrayList<VlanNextObjectiveStoreKey> a = new ArrayList<>(vlanNextObjStore.keySet());
        a.sort(Comparator
                .comparing((VlanNextObjectiveStoreKey o) -> o.deviceId().toString())
                .thenComparing((VlanNextObjectiveStoreKey o) -> o.vlanId().toShort()));

        StringBuilder builder = new StringBuilder();
        a.forEach(k ->
            builder.append("\n")
                    .append(k)
                    .append(" --> ")
                    .append(vlanNextObjStore.get(k))
        );
        print(builder.toString());
    }
Example 15
private final ArrayList<WeightedSocket> activeSockets;

  public void dispose() {
    synchronized (this) {
      activeSockets.forEach(WeightedSocket::dispose);
      activeSockets.clear();
      onClose.onComplete();
    }
  }
Example 16
private ArrayList<NotificationListenerController> mPlugins = new ArrayList<>();

    public void onPluginConnected() {
        mConnected = true;
        mPlugins.forEach(p -> p.onListenerConnected(getProvider()));
    }
Example 17
private final ArrayList<ConfigurationListener> mListeners = new ArrayList<>();

    public void onConfigurationChanged(Configuration newConfig) {
        mListeners.forEach(l -> l.onConfigChanged(newConfig));
        final float fontScale = newConfig.fontScale;
        final int density = newConfig.densityDpi;
        if (density != mDensity || mFontScale != fontScale) {
            mListeners.forEach(l -> l.onDensityOrFontScaleChanged());
            mDensity = density;
            mFontScale = fontScale;
        }
    }
Example 18
private ArrayList<Listener> mListeners = new ArrayList<>();

    private void onMenuVisibilityChanged(boolean visible) {
        mListeners.forEach(l -> l.onPipMenuVisibilityChanged(visible));
        if (visible != mVisible) {
            if (visible) {
                // Once visible, start listening for media action changes. This call will trigger
                // the menu actions to be updated again.
                mMediaController.addListener(mMediaActionListener);
            } else {
                // Once hidden, stop listening for media action changes. This call will trigger
                // the menu actions to be updated again.
                mMediaController.removeListener(mMediaActionListener);
            }
        }
        mVisible = visible;
    }
Example 19
private final ArrayList<Tunable> mTunables = new ArrayList<>();

    public void onDestroy() {
        super.onDestroy();
        mTunables.forEach(t -> mTunerService.removeTunable(t));
    }
Example 20
public void setConfigurerModules(List<ConfigurerModule> configurerModules) {
        ArrayList<ConfigurerModule> modules = new ArrayList<>(configurerModules);
        modules.sort(Comparator.comparingInt(ConfigurerModule::order));
        modules.forEach(c -> c.configureModule(configurer));
    }
Example 21
public void disableAll() {
        ArrayList<PluginInfo> plugins = new ArrayList<>(mPluginHandler.mPlugins);
        plugins.forEach(this::disable);
    }
Example 22
private void swapOrder(LinearLayout linearLayout) {
        ArrayList<View> children = new ArrayList<>();
        for (int i = 0; i < linearLayout.getChildCount(); i++) {
            children.add(0, linearLayout.getChildAt(0));
            linearLayout.removeViewAt(0);
        }
        children.forEach(v -> linearLayout.addView(v));
    }
Example 23
private final ArrayList<ReadablePosition> spyPositions = new ArrayList<>();

    public void close()
    {
        rawLog.close();
        publisherLimit.close();
        senderPosition.close();
        spyPositions.forEach(ReadablePosition::close);
    }
Example 24
protected ArrayList<PersistedDataHost> persistedDataHosts;

    public void initPersistedDataHosts() {
        torSetup.cleanupTorFiles();
        persistedDataHosts.add(p2PService);

        // we apply at startup the reading of persisted data but don't want to get it triggered in the constructor
        persistedDataHosts.forEach(e -> {
            try {
                e.readPersisted();
            } catch (Throwable e1) {
                log.error("readPersisted error", e1);
            }
        });
    }
Example 25
private final ArrayList<IconManager> mIconGroups = new ArrayList<>();

    public void setExternalIcon(String slot) {
        int viewIndex = getViewIndex(getSlotIndex(slot), 0);
        int height = mContext.getResources().getDimensionPixelSize(
                R.dimen.status_bar_icon_drawing_size);
        mIconGroups.forEach(l -> l.onIconExternal(viewIndex, height));
    }