/** * {@inheritDoc} */ public boolean removeAll(final Collection<?> coll) { boolean removed = false; for (final Object value : coll) { removed |= remove(value); } return removed; }
/** * {@inheritDoc} */ public boolean remove(final Object value) { return value instanceof Integer && remove(((Integer)value).intValue()); }
/** * Alias for {@link #removeAll(Collection)} for the specialized case when removing another IntHashSet, * avoids boxing and allocations * * @param coll containing the values to be removed. * @return {@code true} if this set changed as a result of the call */ public boolean removeAll(final IntHashSet coll) { boolean acc = false; for (final int value : coll.values) { if (value != MISSING_VALUE) { acc |= remove(value); } } if (coll.containsMissingValue) { acc |= remove(MISSING_VALUE); } return acc; }
void cleanupIpcPublication(final IpcPublication publication) { activeSessionIds.remove(publication.sessionId()); for (int i = 0, size = subscriptionLinks.size(); i < size; i++) { subscriptionLinks.get(i).unlink(publication); } }
@Test public void removingAnElementFromAnEmptyListDoesNothing() { assertFalse(testSet.remove(0)); }
public void removeSubscription(final int streamId, final int sessionId) { final StreamInterest streamInterest = streamInterestByIdMap.get(streamId); if (null == streamInterest) { throw new UnknownSubscriptionException("No subscription registered on stream " + streamId); } final SessionInterest sessionInterest = streamInterest.sessionInterestByIdMap.remove(sessionId); if (null != sessionInterest && null != sessionInterest.image) { sessionInterest.image.ifActiveGoInactive(); } streamInterest.subscribedSessionIds.remove(sessionId); if (!streamInterest.isForAllSessions && streamInterest.subscribedSessionIds.isEmpty()) { streamInterestByIdMap.remove(streamId); } }
void cleanupPublication(final NetworkPublication publication) { activeSessionIds.remove(publication.sessionId()); senderProxy.removeNetworkPublication(publication); final SendChannelEndpoint channelEndpoint = publication.channelEndpoint(); if (channelEndpoint.shouldBeClosed()) { channelEndpoint.closeStatusIndicator(); sendChannelEndpointByChannelMap.remove(channelEndpoint.udpChannel().canonicalForm()); senderProxy.closeSendChannelEndpoint(channelEndpoint); } }
@Test public void reducesSizeWhenElementRemoved() { addTwoElements(testSet); testSet.remove(1001); assertEquals(1, testSet.size()); }
@Test public void chainCompactionShouldNotCauseElementsToBeMovedBeforeTheirHash() { final IntHashSet requiredFields = new IntHashSet(14); requiredFields.add(8); requiredFields.add(9); requiredFields.add(35); requiredFields.add(49); requiredFields.add(56); assertTrue("Failed to remove 8", requiredFields.remove(8)); assertTrue("Failed to remove 9", requiredFields.remove(9)); assertThat(requiredFields, containsInAnyOrder(35, 49, 56)); }
@Test public void removingAPresentElementRemovesIt() { assertTrue(testSet.add(1)); assertTrue(testSet.remove(1)); assertFalse(testSet.contains(1)); }
@Test public void equalsAccountsForMissingValue() { addTwoElements(testSet); testSet.add(MISSING_VALUE); final IntHashSet other = new IntHashSet(100); addTwoElements(other); assertNotEquals(testSet, other); other.add(MISSING_VALUE); assertEquals(testSet, other); testSet.remove(MISSING_VALUE); assertNotEquals(testSet, other); }
@Test public void hashCodeAccountsForMissingValue() { addTwoElements(testSet); testSet.add(MISSING_VALUE); final IntHashSet other = new IntHashSet(100); addTwoElements(other); assertNotEquals(testSet.hashCode(), other.hashCode()); other.add(MISSING_VALUE); assertEquals(testSet.hashCode(), other.hashCode()); testSet.remove(MISSING_VALUE); assertNotEquals(testSet.hashCode(), other.hashCode()); }
/** * {@inheritDoc} */ public boolean removeAll(final Collection<?> coll) { boolean removed = false; for (final Object value : coll) { removed |= remove(value); } return removed; }
/** * {@inheritDoc} */ public boolean remove(final Object value) { return value instanceof Integer && remove(((Integer)value).intValue()); }
/** * {@inheritDoc} */ public boolean remove(final Object value) { return value instanceof Integer && remove(((Integer)value).intValue()); }
void cleanupIpcPublication(final IpcPublication publication) { activeSessionIds.remove(publication.sessionId()); for (int i = 0, size = subscriptionLinks.size(); i < size; i++) { subscriptionLinks.get(i).unlink(publication); } }
void cleanupIpcPublication(final IpcPublication publication) { activeSessionIds.remove(publication.sessionId()); for (int i = 0, size = subscriptionLinks.size(); i < size; i++) { subscriptionLinks.get(i).unlink(publication); } }
void cleanupPublication(final NetworkPublication publication) { activeSessionIds.remove(publication.sessionId()); senderProxy.removeNetworkPublication(publication); final SendChannelEndpoint channelEndpoint = publication.channelEndpoint(); if (channelEndpoint.shouldBeClosed()) { channelEndpoint.closeStatusIndicator(); sendChannelEndpointByChannelMap.remove(channelEndpoint.udpChannel().canonicalForm()); senderProxy.closeSendChannelEndpoint(channelEndpoint); } }
void cleanupPublication(final NetworkPublication publication) { activeSessionIds.remove(publication.sessionId()); senderProxy.removeNetworkPublication(publication); final SendChannelEndpoint channelEndpoint = publication.channelEndpoint(); if (channelEndpoint.shouldBeClosed()) { channelEndpoint.closeStatusIndicator(); sendChannelEndpointByChannelMap.remove(channelEndpoint.udpChannel().canonicalForm()); senderProxy.closeSendChannelEndpoint(channelEndpoint); } }