/** * Returns the sum of the given lists. This is their intersection * subtracted from their union. * * @param list1 the first list * @param list2 the second list * @return a new list containing the sum of those lists * @throws NullPointerException if either list is null */ public static List sum(final List list1, final List list2) { return subtract(union(list1, list2), intersection(list1, list2)); }
/** * Returns the sum of the given lists. This is their intersection * subtracted from their union. * * @param list1 the first list * @param list2 the second list * @return a new list containing the sum of those lists * @throws NullPointerException if either list is null */ public static List sum(final List list1, final List list2) { return subtract(union(list1, list2), intersection(list1, list2)); }
private void verify(String duration, List<TimestampedDatasetVersion> toBeDeleted, List<TimestampedDatasetVersion> toBeRetained) { @SuppressWarnings("unchecked") List<TimestampedDatasetVersion> allVersions = ListUtils.union(toBeRetained, toBeDeleted); List<TimestampedDatasetVersion> deletableVersions = Lists.newArrayList(new TimeBasedRetentionPolicy(duration).listDeletableVersions(allVersions)); assertThat(deletableVersions, Matchers.containsInAnyOrder(toBeDeleted.toArray())); assertThat(deletableVersions, Matchers.not(Matchers.containsInAnyOrder(toBeRetained.toArray()))); }
@Test public void updateGetAndReplaceConcurrently() throws Exception { AtomicBoolean condition = new AtomicBoolean( true ); AtomicInteger generator = new AtomicInteger( 10 ); List<Updater> updaters = new ArrayList<>(); for ( int i = 0; i < updatersAmount; i++ ) { Updater updater = new Updater( jobMap, generator, updatersCycles ); updaters.add( updater ); } List<Getter> getters = new ArrayList<>(); for ( int i = 0; i < gettersAmount; i++ ) { getters.add( new Getter( jobMap, condition ) ); } List<Replacer> replacers = new ArrayList<>(); for ( int i = 0; i < replaceAmount; i++ ) { replacers.add( new Replacer( jobMap, condition ) ); } //noinspection unchecked ConcurrencyTestRunner.runAndCheckNoExceptionRaised( updaters, ListUtils.union( replacers, getters ), condition ); }
@Test public void readAndUpdateTrackerConcurrently() throws Exception { final AtomicBoolean condition = new AtomicBoolean( true ); List<Getter> getters = new ArrayList<Getter>( gettersAmount ); for ( int i = 0; i < gettersAmount; i++ ) { getters.add( new Getter( condition, tracker ) ); } List<Searcher> searchers = new ArrayList<Searcher>( searchersAmount ); for ( int i = 0; i < searchersAmount; i++ ) { int lookingFor = updatersAmount * updatersCycles / 2 + i; assertTrue( "We are looking for reachable index", lookingFor < updatersAmount * updatersCycles ); searchers.add( new Searcher( condition, tracker, mockJobEntryCopy( "job-entry-" + lookingFor, lookingFor ) ) ); } final AtomicInteger generator = new AtomicInteger( 0 ); List<Updater> updaters = new ArrayList<Updater>( updatersAmount ); for ( int i = 0; i < updatersAmount; i++ ) { updaters.add( new Updater( tracker, updatersCycles, generator, "job-entry-%d" ) ); } //noinspection unchecked ConcurrencyTestRunner.runAndCheckNoExceptionRaised( updaters, ListUtils.union( getters, searchers ), condition ); assertEquals( updatersAmount * updatersCycles, generator.get() ); }
private Collection<?> getLifecycleManagedObjects() { if (defaultProcessor == null) { return conditionalMessageProcessors; } return ListUtils.union(conditionalMessageProcessors, Collections.singletonList(defaultProcessor)); }
private Collection<?> getLifecycleManagedObjects() { if (!defaultProcessor.isPresent()) { return conditionalMessageProcessors; } return union(conditionalMessageProcessors, singletonList(defaultProcessor.get())); }
public double simSMC (ArrayList<Integer> intent1, ArrayList<Integer>intent2){ int tp = (ListUtils.intersection(intent1,intent2)).size(); ArrayList<Integer> fnlst = new ArrayList<Integer>(); fnlst.addAll(this.attributes); fnlst.removeAll(ListUtils.union(intent1,intent2)); int fn = fnlst.size(); return (this.attributes.size()>0) ? 1.*(tp + fn)/this.attributes.size() : 0; }
private static List mustContainAtLeastOneItemMatching(List<BeanCollectionMatcher> matchers) { return ListUtils.union(matchers, Arrays.asList(BeanMatchers.the_count(is(not(0))))); }
private static List mustContainAtLeastOneItemMatching(List<BeanCollectionMatcher> matchers) { return ListUtils.union(matchers, Arrays.asList(BeanMatchers.the_count(is(not(0))))); }
/** * Returns the sum of the given lists. This is their intersection * subtracted from their union. * * @param list1 the first list * @param list2 the second list * @return a new list containing the sum of those lists * @throws NullPointerException if either list is null */ public static List sum(final List list1, final List list2) { return subtract(union(list1, list2), intersection(list1, list2)); }
/** * Returns the sum of the given lists. This is their intersection * subtracted from their union. * * @param list1 the first list * @param list2 the second list * @return a new list containing the sum of those lists * @throws NullPointerException if either list is null */ public static List sum(final List list1, final List list2) { return subtract(union(list1, list2), intersection(list1, list2)); }
/** * Returns the sum of the given lists. This is their intersection * subtracted from their union. * * @param list1 the first list * @param list2 the second list * @return a new list containing the sum of those lists * @throws NullPointerException if either list is null */ public static List sum(final List list1, final List list2) { return subtract(union(list1, list2), intersection(list1, list2)); }
/** * Returns the sum of the given lists. This is their intersection * subtracted from their union. * * @param list1 the first list * @param list2 the second list * @return a new list containing the sum of those lists * @throws NullPointerException if either list is null */ public static List sum(final List list1, final List list2) { return subtract(union(list1, list2), intersection(list1, list2)); }
/** * Returns the sum of the given lists. This is their intersection * subtracted from their union. * * @param list1 the first list * @param list2 the second list * @return a new list containing the sum of those lists * @throws NullPointerException if either list is null */ public static List sum(final List list1, final List list2) { return subtract(union(list1, list2), intersection(list1, list2)); }
@SuppressWarnings("unchecked") public static <T> List<T> union(ActionContext actionContext){ Thing self = actionContext.getObject("self"); List<T> list1 = (List<T>) self.doAction("getList1", actionContext); List<T> list2 = (List<T>) self.doAction("getList2", actionContext); return ListUtils.union(list1, list2); }
/** * List of all {@link JobProperty} exposed primarily for the remoting API. * List contains cascadable {@link JobProperty} if any. * @since 2.2.0 */ @Exported(name = "property", inline = true) public List<JobProperty<? super JobT>> getAllProperties() { CopyOnWriteList cascadingJobProperties = getCascadingJobProperties(); List<JobProperty<? super JobT>> result = properties.getView(); if (null != cascadingJobProperties && !cascadingJobProperties.isEmpty()) { result = Collections.unmodifiableList(ListUtils.union(result, cascadingJobProperties.getView())); } return result; }
/** * List of all {@link JobProperty} exposed primarily for the remoting API. * List contains cascadable {@link JobProperty} if any. * @since 2.2.0 */ @Exported(name = "property", inline = true) public List<JobProperty<? super JobT>> getAllProperties() { CopyOnWriteList cascadingJobProperties = getCascadingJobProperties(); List<JobProperty<? super JobT>> result = properties.getView(); if (null != cascadingJobProperties && !cascadingJobProperties.isEmpty()) { result = Collections.unmodifiableList(ListUtils.union(result, cascadingJobProperties.getView())); } return result; }
/** * List of all {@link JobProperty} exposed primarily for the remoting API. * List contains cascadable {@link JobProperty} if any. * * @since 2.2.0 */ @Exported(name = "property", inline = true) @SuppressWarnings("unchecked") public List<JobProperty<? super JobT>> getAllProperties() { CopyOnWriteList cascadingJobProperties = getCascadingJobProperties(); List<JobProperty<? super JobT>> result = properties.getView(); if (null != cascadingJobProperties && !cascadingJobProperties.isEmpty()) { result = Collections.unmodifiableList(ListUtils.union(result, cascadingJobProperties.getView())); } return result; }
@Test(dataProviderClass = AdsDataProvider.class, dataProvider = "adsUapOasis", groups = "AdsUapOasis") public void adsUapOasis( Page page, List<Map<String, Object>> atfSlots, List<Map<String, Object>> btfSlots ) { AdsBaseObject ads = new AdsBaseObject(driver, page.getUrl(RESOLVED_STATE), WindowSize.DESKTOP); verifySlotsUnblocked(ads, atfSlots); verifySlotsBlocked(ads, btfSlots); verifySlotsUnblocked(ads, ListUtils.union(atfSlots, btfSlots)); }