APISonar


java.util.ArrayList.removeIf

> java > util > ArrayList > removeIf
java APIs util APIs ArrayList APIs removeIf APIs

Example 1
private static ArrayList<WeakReference<Consumer<Boolean>>> sCallbacks = new ArrayList<>();

    private static void onDockedStackExistsChanged(boolean exists) {
        mLastExists = exists;
        synchronized (sCallbacks) {
            sCallbacks.removeIf(wf -> {
                Consumer<Boolean> l = wf.get();
                if (l != null) l.accept(exists);
                return l == null;
            });
        }
    }
Example 2
static String removeReplicasFromConfig(String throttleConfig, Set<String> replicas) {
    ArrayList<String> throttles = new ArrayList<>(Arrays.asList(throttleConfig.split(",")));
    throttles.removeIf(replicas::contains);
    return String.join(",", throttles);
  }
Example 3
private static ArrayList<String> sRenderMessages = Lists.newArrayList();

    public void testAllWidgets() throws ClassNotFoundException {
        renderAndVerify("allwidgets.xml", "allwidgets.png");

        // We expect fidelity warnings for Path.isConvex. Fail for anything else.
        sRenderMessages.removeIf(message -> message.equals("Path.isConvex is not supported."));
    }
Example 4
public static List<ShortcutInfo> filter(List<ShortcutInfo> list, Predicate<ShortcutInfo> p) {
        final ArrayList<ShortcutInfo> ret = new ArrayList<>(list);
        ret.removeIf(si -> !p.test(si));
        return ret;
    }
Example 5
private final ArrayList<WeakReference<Theme>> mThemeRefs = new ArrayList<>();

    public final Theme newTheme() {
        Theme theme = new Theme();
        theme.setImpl(mResourcesImpl.newThemeImpl());
        synchronized (mThemeRefs) {
            mThemeRefs.add(new WeakReference<>(theme));

            // Clean up references to garbage collected themes
            if (mThemeRefs.size() > mThemeRefsNextFlushSize) {
                mThemeRefs.removeIf(ref -> ref.get() == null);
                mThemeRefsNextFlushSize = Math.max(MIN_THEME_REFS_FLUSH_SIZE,
                        2 * mThemeRefs.size());
            }
        }
        return theme;
    }
Example 6
private ArrayList<Approval> store = new ArrayList<Approval>();

    public boolean revokeApprovalsForClientAndUser(String clientId, String userId, final String zoneId) {
        return store.removeIf(
            approval ->
                clientId.equals(approval.getClientId()) &&
                userId.equals(approval.getUserId())
        );
    }
Example 7
private static final ArrayList<PopupPanel> dialogStack_ = new ArrayList<>();

   public static void onHide(PopupPanel panel)
   {
      dialogStack_.removeIf(panel::equals);
      if (Desktop.hasDesktopFrame() && numModalsShowing() == 0)
         DesktopMenuCallback.setMainMenuEnabled(true);
      updateInert();
   }
Example 8
private final ArrayList<RankedListener> mListeners = new ArrayList<>();

    public void removeCallback(StateListener listener) {
        synchronized (mListeners) {
            mListeners.removeIf((it) -> it.mListener.equals(listener));
        }
    }
Example 9
public static DataHolder removeExtensions(@NotNull DataHolder options, @NotNull Collection<Class<? extends Extension>> excludeExtensions) {
        if (options.contains(EXTENSIONS)) {
            ArrayList<Extension> extensions = new ArrayList<>(EXTENSIONS.get(options));
            boolean removed = extensions.removeIf(it->excludeExtensions.contains(it.getClass()));
            if (removed) {
                if (options instanceof MutableDataHolder) {
                    return ((MutableDataHolder) options).set(EXTENSIONS, extensions);
                } else {
                    return options.toMutable().set(EXTENSIONS, extensions).toImmutable();
                }
            }
        }
        return options;
    }
Example 10
public List<UnitPositionInfo> getUnitsForNode(SNode node) {
    final SNodeId id = node.getNodeId();
    DebugInfoRoot debugInfoRoot = myRoots.get(getRef(node.getContainingRoot()));
    if (debugInfoRoot != null) {
      ArrayList<UnitPositionInfo> unitPositions = new ArrayList<>(debugInfoRoot.getUnitPositions());
      // FIXME StartLineComparator is always wrapped with reverseOrder, no need to have it that way
      Collections.sort(unitPositions, Collections.reverseOrder(new PositionInfo.StartLineComparator()));
      unitPositions.removeIf(pi -> !pi.matches(id));
      return unitPositions;
    }
    return Collections.emptyList();
  }