Skip to content

Instantly share code, notes, and snippets.

@Kikimora
Last active August 29, 2015 14:23
Show Gist options
  • Save Kikimora/733a5b25530629f529e9 to your computer and use it in GitHub Desktop.
Save Kikimora/733a5b25530629f529e9 to your computer and use it in GitHub Desktop.
public class ExternalNews {
ObjectReference[] refs;
NewsData news;
public void addReference(ObjectReference ref) {
refs.add(ref);
}
public Stream<ObjectReference> references() {
return StreamSupport.join(movies.stream(), person.stream());
}
public void done() {
for(ObjectReference r : refs) {
if (r.getObject() instanceof MovieData) {
news.movieRefs.add(r.getObject())
} else if (r.getObject() instanceof PersonData) {
news.personRefs.add(r.getObject())
}
}
}
}
public class NewsData {
private MovieReference[] movieRefs;
private PersonReference[] personRefs;
private EntityId[] movieIds, personIds;
}
public interface ObjectReference<T> {
}
public class MovieReference implements ObjectReference<Movie> {
}
public class PersonReference implements ObjectReference<Movie> {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment