31
31
import com .google .spanner .v1 .ResultSetStats ;
32
32
import java .util .Collection ;
33
33
import java .util .LinkedList ;
34
+ import java .util .List ;
34
35
import java .util .concurrent .BlockingDeque ;
35
36
import java .util .concurrent .Callable ;
36
37
import java .util .concurrent .CountDownLatch ;
@@ -483,12 +484,12 @@ public void resume() {
483
484
}
484
485
485
486
private static class CreateListCallback <T > implements ReadyCallback {
486
- private final SettableApiFuture <ImmutableList <T >> future ;
487
+ private final SettableApiFuture <List <T >> future ;
487
488
private final Function <StructReader , T > transformer ;
488
489
private final ImmutableList .Builder <T > builder = ImmutableList .builder ();
489
490
490
491
private CreateListCallback (
491
- SettableApiFuture <ImmutableList <T >> future , Function <StructReader , T > transformer ) {
492
+ SettableApiFuture <List <T >> future , Function <StructReader , T > transformer ) {
492
493
this .future = future ;
493
494
this .transformer = transformer ;
494
495
}
@@ -516,20 +517,20 @@ public CallbackResponse cursorReady(AsyncResultSet resultSet) {
516
517
}
517
518
518
519
@ Override
519
- public <T > ApiFuture <ImmutableList <T >> toListAsync (
520
+ public <T > ApiFuture <List <T >> toListAsync (
520
521
Function <StructReader , T > transformer , Executor executor ) {
521
522
synchronized (monitor ) {
522
523
Preconditions .checkState (!closed , "This AsyncResultSet has been closed" );
523
524
Preconditions .checkState (
524
525
this .state == State .INITIALIZED , "This AsyncResultSet has already been used." );
525
- final SettableApiFuture <ImmutableList <T >> res = SettableApiFuture .<ImmutableList <T >>create ();
526
+ final SettableApiFuture <List <T >> res = SettableApiFuture .<List <T >>create ();
526
527
CreateListCallback <T > callback = new CreateListCallback <T >(res , transformer );
527
528
ApiFuture <Void > finished = setCallback (executor , callback );
528
529
return ApiFutures .transformAsync (
529
530
finished ,
530
- new ApiAsyncFunction <Void , ImmutableList <T >>() {
531
+ new ApiAsyncFunction <Void , List <T >>() {
531
532
@ Override
532
- public ApiFuture <ImmutableList <T >> apply (Void input ) throws Exception {
533
+ public ApiFuture <List <T >> apply (Void input ) throws Exception {
533
534
return res ;
534
535
}
535
536
},
@@ -538,9 +539,8 @@ public ApiFuture<ImmutableList<T>> apply(Void input) throws Exception {
538
539
}
539
540
540
541
@ Override
541
- public <T > ImmutableList <T > toList (Function <StructReader , T > transformer )
542
- throws SpannerException {
543
- ApiFuture <ImmutableList <T >> future = toListAsync (transformer , MoreExecutors .directExecutor ());
542
+ public <T > List <T > toList (Function <StructReader , T > transformer ) throws SpannerException {
543
+ ApiFuture <List <T >> future = toListAsync (transformer , MoreExecutors .directExecutor ());
544
544
try {
545
545
return future .get ();
546
546
} catch (ExecutionException e ) {
0 commit comments