Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. interface ParticleInt<O extends ParticleInt<O>>{
  2. O withSmt();
  3. }
  4.  
  5. class Particle implements ParticleInt<Particle>{
  6. @Override
  7. public Particle withSmt() {
  8. return new Particle();
  9. }
  10. }
  11.  
  12. class Particle2 implements ParticleInt<Particle2>{
  13. @Override
  14. public Particle2 withSmt() {
  15. return new Particle2();
  16. }
  17. }
  18.  
  19. interface Executable<P extends ParticleInt<? extends ParticleInt>>{
  20. void setExecutableStrategy(ExecutableStrategy<P> s);
  21. }
  22.  
  23. interface ExecutableStrategy<P extends ParticleInt<? extends ParticleInt>>{
  24. Stream<P> exec(List<P> l);
  25. }
  26.  
  27. class Particle2Strat implements ExecutableStrategy<Particle2>{
  28. @Override
  29. public Stream<Particle2> exec(List<Particle2> l) {
  30. return l.stream().map(x -> x.withSmt());
  31. }
  32. }
  33.  
  34. class ParticleStrat<P extends ParticleInt<? extends ParticleInt>> implements ExecutableStrategy<P>{
  35. @Override
  36. public Stream<P> exec(List<P> l) {
  37. return l.stream().map(x -> x.withSmt());
  38. // [44,38] incompatible types: inference variable R has incompatible bounds
  39. // equality constraints: P
  40. // [ERROR] lower bounds: capture#1 of ? extends ParticleInt
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement