Skip to content

Instantly share code, notes, and snippets.

@yamanyar
Created April 7, 2012 05:28
Show Gist options
  • Save yamanyar/2325538 to your computer and use it in GitHub Desktop.
Save yamanyar/2325538 to your computer and use it in GitHub Desktop.
CanonicalSet example
private CanonicalSet<relation> repository =
CanonicalSet.newInstance(Relation.class);
public Relation getSharedInstance(Relation relation) {
if (active) {
//following method is not in set interface. it returns the equivalent object from set for the given relation
final ImmutableRelation immutableRelation = new ImmutableRelation(relation);
return repository.unique(immutableRelation);
} else {
return relation;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment