Permalink
Browse files

For consistency, have distinct capability return a list

  • Loading branch information...
twschiller committed Nov 8, 2013
1 parent e1686fb commit a4c9cf54a1f6d0a16ebdf8b9b895aa43e9c105e1
Showing with 7 additions and 5 deletions.
  1. +7 −5 edu.washington.cs.cupid/src/edu/washington/cs/cupid/standard/Distinct.java
@@ -11,8 +11,10 @@
package edu.washington.cs.cupid.standard;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.reflect.TypeToken;
@@ -25,7 +27,7 @@
* @author Todd Schiller
* @param <V> element type
*/
public final class Distinct<V> extends GenericLinearCapability<Collection<V>, Set<V>> {
public final class Distinct<V> extends GenericLinearCapability<Collection<V>, List<V>> {
/**
* A capability that returns the number of elements in a collection.
@@ -45,15 +47,15 @@ public Distinct() {
}
@Override
public TypeToken<Set<V>> getOutputType() {
return new TypeToken<Set<V>>(getClass()) {
public TypeToken<List<V>> getOutputType() {
return new TypeToken<List<V>>(getClass()) {
private static final long serialVersionUID = 1L;
};
}
@Override
public LinearJob<Collection<V>, Set<V>> getJob(final Collection<V> input) {
return new ImmediateJob<Collection<V>, Set<V>>(this, input, Sets.newHashSet(input));
public LinearJob<Collection<V>, List<V>> getJob(final Collection<V> input) {
return new ImmediateJob<Collection<V>, List<V>>(this, input, Lists.newArrayList(Sets.newHashSet(input)));
}
}

0 comments on commit a4c9cf5

Please sign in to comment.