@Benchmark public scala.collection.immutable.Map<String, String> immutableScalaPut() { int localSize = this.size; String[] localElements = this.elements; scala.collection.immutable.Map<String, String> map = HashMap$.MODULE$.empty(); for (int i = 0; i < localSize; i++) { map = map.updated(localElements[i], "dummy"); } return map; } }
private static scala.collection.Map<Object, scala.collection.Seq<Object>> getPartitionAssignment(KafkaZkClient zkClient, String topic) { scala.collection.immutable.Set<String> topicList = new scala.collection.immutable.Set.Set1<>(topic); return zkClient.getPartitionAssignmentForTopics(topicList).apply(topic); }
/** * Makes a prediction using MLeap API. * * @param inputFrame Input MLeap frame. * @return Prediction result. */ public double predict(DefaultLeapFrame inputFrame) { DefaultLeapFrame outputFrame = transformer.transform(inputFrame).get(); Try<DefaultLeapFrame> resFrame = outputFrame.select(new Set.Set1<>(outputFieldName).toSeq()); DefaultLeapFrame frame = resFrame.get(); Stream<?> stream = (Stream<?>)frame.productElement(1); Row row = (Row)stream.head(); return (Double)row.get(0); }
/** * Same as <code>receiveN(n, remaining())</code>, but correctly treating the * timeFactor. */ public Object[] receiveN(int n) { return (Object[]) p.receiveN(n).toArray(Util.classTag(Object.class)); }
@Test public void scalaSparkContext() { List<String> jars = List$.MODULE$.empty(); Map<String, String> environment = Map$.MODULE$.empty(); new SparkContext(new SparkConf().setMaster("local").setAppName("name")).stop(); new SparkContext("local", "name", new SparkConf()).stop(); new SparkContext("local", "name").stop(); new SparkContext("local", "name", "sparkHome").stop(); new SparkContext("local", "name", "sparkHome", jars).stop(); new SparkContext("local", "name", "sparkHome", jars, environment).stop(); } }
/** * Receive N messages in a row before the given deadline. */ public Object[] receiveN(int n, FiniteDuration max) { return (Object[]) p.receiveN(n, max).toArray(Util.classTag(Object.class)); }
@Test public void scalaSparkContext() { List<String> jars = List$.MODULE$.empty(); Map<String, String> environment = Map$.MODULE$.empty(); new SparkContext(new SparkConf().setMaster("local").setAppName("name")).stop(); new SparkContext("local", "name", new SparkConf()).stop(); new SparkContext("local", "name").stop(); new SparkContext("local", "name", "sparkHome").stop(); new SparkContext("local", "name", "sparkHome", jars).stop(); new SparkContext("local", "name", "sparkHome", jars, environment).stop(); } }
@Setup public void setUp() { Random random = new Random(123456789012345L); this.elements = new String[this.size]; Map<String, String> map = HashMap$.MODULE$.empty(); for (int i = 0; i < this.size; i++) { String element = RandomStringUtils.random(RANDOM_COUNT, 0, 0, false, true, null, random); this.elements[i] = element; map = map.updated(element, "dummy"); } this.scalaMap = map; }
@SuppressWarnings("unchecked") public ReceiveWhile(Class<T> clazz, Duration max, Duration idle, int messages) { results = p.receiveWhile(max, idle, messages, new CachingPartialFunction<Object, T>() { public T match(Object msg) throws Exception { return ReceiveWhile.this.match(msg); } }).toArray(Util.classTag(clazz)); }
/** Same as <code>receiveN(n, remaining())</code>, but correctly treating the timeFactor. */ public Object[] receiveN(int n) { return (Object[]) p.receiveN(n).toArray(Util.classTag(Object.class)); }
/** Receive N messages in a row before the given deadline. */ public Object[] receiveN(int n, FiniteDuration max) { return (Object[]) p.receiveN(n, max).toArray(Util.classTag(Object.class)); }
/** Same as <code>receiveN(n, remaining())</code>, but correctly treating the timeFactor. */ public Object[] receiveN(int n) { return (Object[]) p.receiveN(n).toArray(Util.classTag(Object.class)); }
/** Receive N messages in a row before the given deadline. */ public Object[] receiveN(int n, FiniteDuration max) { return (Object[]) p.receiveN(n, max).toArray(Util.classTag(Object.class)); }
@SuppressWarnings("all") public ReceiveWhile(Class<T> clazz, Duration max, Duration idle, int messages) { results = p.receiveWhile( max, idle, messages, new CachingPartialFunction<Object, T>() { public T match(Object msg) throws Exception { return ReceiveWhile.this.match(msg); } }) .toArray(Util.classTag(clazz)); }
/** * Same as <code>expectMsgAllOf(remainingOrDefault(), obj...)</code>, but correctly treating the * timeFactor. */ public Object[] expectMsgAllOf(Object... msgs) { return (Object[]) p.expectMsgAllOf(Util.immutableSeq(msgs)).toArray(Util.classTag(Object.class)); }
/** * Same as <code>expectMsgAllOf(remaining(), obj...)</code>, but correctly * treating the timeFactor. */ public Object[] expectMsgAllOf(Object... msgs) { return (Object[]) p.expectMsgAllOf(Util.immutableSeq(msgs)).toArray(Util.classTag(Object.class)); }
/** * Same as <code>expectMsgAllOf(remainingOrDefault(), obj...)</code>, but correctly treating the * timeFactor. */ public Object[] expectMsgAllOf(Object... msgs) { return (Object[]) p.expectMsgAllOf(Util.immutableSeq(msgs)).toArray(Util.classTag(Object.class)); }
/** * Receive a number of messages from the test actor matching the given number * of objects and assert that for each given object one is received which * equals it and vice versa. This construct is useful when the order in which * the objects are received is not fixed. Wait time is bounded by the given * duration, with an AssertionFailure being thrown in case of timeout. */ public Object[] expectMsgAllOf(FiniteDuration max, Object... msgs) { return (Object[]) p.expectMsgAllOf(max, Util.immutableSeq(msgs)).toArray(Util.classTag(Object.class)); }
/** * Receive a number of messages from the test actor matching the given number of objects and * assert that for each given object one is received which equals it and vice versa. This * construct is useful when the order in which the objects are received is not fixed. Wait time is * bounded by the given duration, with an AssertionFailure being thrown in case of timeout. */ public Object[] expectMsgAllOf(FiniteDuration max, Object... msgs) { return (Object[]) p.expectMsgAllOf(max, Util.immutableSeq(msgs)).toArray(Util.classTag(Object.class)); }
/** * Receive a number of messages from the test actor matching the given number of objects and * assert that for each given object one is received which equals it and vice versa. This * construct is useful when the order in which the objects are received is not fixed. Wait time is * bounded by the given duration, with an AssertionFailure being thrown in case of timeout. */ public Object[] expectMsgAllOf(FiniteDuration max, Object... msgs) { return (Object[]) p.expectMsgAllOf(max, Util.immutableSeq(msgs)).toArray(Util.classTag(Object.class)); }