Skip to content

Instantly share code, notes, and snippets.

@ktoso
Last active August 29, 2015 14:07
Show Gist options
  • Save ktoso/282e6ed805da3d93c38f to your computer and use it in GitHub Desktop.
Save ktoso/282e6ed805da3d93c38f to your computer and use it in GitHub Desktop.
/**
* Copyright (C) 2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.stream.javadsl.japi;
import org.reactivestreams.Subscriber;
import java.util.concurrent.Future;
public class JavaPain {
{
Materialized materialized = new Materialized();
DrainWithTheKey<Object, Subscriber<Long>> drainKey = new DrainWithTheKey<Object, Subscriber<Long>>();
Subscriber<Long> drainFor = materialized.getDrainFor(drainKey);
Future<String> future1 = materialized.getDrainFor(new DrainWithTheKey<String, Future<String>>());
DrainWithTheKey<String, Future<String>> foldDrain = new FoldDrain<String, Future<String>>();
Future<String> future2 = materialized.getDrainFor(foldDrain);
}
}
class FoldDrain<U, In> extends DrainWithTheKey<In, Future<U>> { }
class DrainWithTheKey<A, Type> {
public Type value() { return null; }
}
class Materialized {
public <T> T getDrainFor(DrainWithTheKey<?, T> drainKey) { return null; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment