make it compile in SBT & Eclipse with 2.9.2-SNAPSHOT
- there is one remaining bug, which makes it impossible to implement Function1[T, Boolean] from Java (I wonder if this will ever work, given that there is no equivalent type expressible in Java) - hence create Function1 in Scala code, Java only prepares a Filter SAM which does not inherit from anything - ugly (one more alloc) but the only way I see right now.
This commit is contained in:
parent
74a36e5ddb
commit
0cb2184904
4 changed files with 15 additions and 18 deletions
|
|
@ -317,17 +317,17 @@ public class FutureDocTestBase {
|
|||
public void useFilter() throws Exception {
|
||||
//#filter
|
||||
Future<Integer> future1 = Futures.successful(4, system.dispatcher());
|
||||
Future<Integer> successfulFilter = future1.filter(new Filter<Integer>() {
|
||||
Future<Integer> successfulFilter = future1.filter(Filter.create(new Filter<Integer>() {
|
||||
public boolean filter(Integer i) {
|
||||
return i % 2 == 0;
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
Future<Integer> failedFilter = future1.filter(new Filter<Integer>() {
|
||||
Future<Integer> failedFilter = future1.filter(Filter.create(new Filter<Integer>() {
|
||||
public boolean filter(Integer i) {
|
||||
return i % 2 != 0;
|
||||
}
|
||||
});
|
||||
}));
|
||||
//When filter fails, the returned Future will be failed with a scala.MatchError
|
||||
//#filter
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue