Browse Source

init a list with only one element with singleton function to enhance perf (#9208)

Reviewers: Bill Bejeck <bbejeck@apache.org>
pull/6976/head
khairy 4 years ago committed by GitHub
parent
commit
c180823bdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      streams/src/test/java/org/apache/kafka/streams/processor/internals/ProcessorNodeTest.java
  2. 3
      streams/src/test/java/org/apache/kafka/streams/state/internals/FilteredCacheIteratorTest.java

3
streams/src/test/java/org/apache/kafka/streams/processor/internals/ProcessorNodeTest.java

@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
*/
package org.apache.kafka.streams.processor.internals;
import java.util.Arrays;
import java.util.Properties;
import org.apache.kafka.common.metrics.Metrics;
import org.apache.kafka.common.serialization.StringSerializer;
@ -169,7 +168,7 @@ public class ProcessorNodeTest { @@ -169,7 +168,7 @@ public class ProcessorNodeTest {
builder.<String, String>stream("streams-plaintext-input")
.flatMapValues(value -> {
return Arrays.asList("");
return Collections.singletonList("");
});
final Topology topology = builder.build();

3
streams/src/test/java/org/apache/kafka/streams/state/internals/FilteredCacheIteratorTest.java

@ -25,6 +25,7 @@ import org.apache.kafka.test.GenericInMemoryKeyValueStore; @@ -25,6 +25,7 @@ import org.apache.kafka.test.GenericInMemoryKeyValueStore;
import org.junit.Before;
import org.junit.Test;
import java.util.Collections;
import java.util.List;
import static java.util.Arrays.asList;
@ -121,7 +122,7 @@ public class FilteredCacheIteratorTest { @@ -121,7 +122,7 @@ public class FilteredCacheIteratorTest {
@Test
public void shouldFilterEntriesNotMatchingHasNextCondition() {
final List<KeyValue<Bytes, LRUCacheEntry>> keyValues = toList(firstEntryIterator);
assertThat(keyValues, equalTo(asList(firstEntry)));
assertThat(keyValues, equalTo(Collections.singletonList(firstEntry)));
}
@Test(expected = UnsupportedOperationException.class)

Loading…
Cancel
Save