BAEL-1035 Introduction to Eclipse Collections (#2421)
* Evaluation article: Different Types of Bean Injection in Spring * added tests & changed configuration to Java-based config * removed xml config files * rename unit tests * BAEL-972 - Apache Commons Text * remove code from evaluation article * remove code from evaluation article * BAEL-972 - Apache Commons Text - added another example * BAEL-972 - Apache Commons Text - just indentation * BAEL-994 - TemporalAdjuster in Java * BAEL-994 - TemporalAdjuster in Java * BAEL-994 - TemporalAdjuster in Java * BAEL-994 - TemporalAdjuster in Java * BAEL-994 - TemporalAdjuster in Java - fix problems * BAEL-1033 Introduction to StreamUtils * BAEL-1033 Introduction to StreamUtils * BAEL-1033 Introduction to StreamUtils * fix formatting * BAEL-1033 minor refactor * BAEL-1035 Introduction to Eclipse Collections * format * BAEL-1035 Introduction to Eclipse Collections * BAEL-1035 Introduction to Eclipse Collections
This commit is contained in:
committed by
Grzegorz Piwowarek
parent
a4132df3e5
commit
310e89e4f0
@@ -0,0 +1,22 @@
|
||||
package com.baeldung.eclipsecollections;
|
||||
|
||||
import org.eclipse.collections.api.list.MutableList;
|
||||
import org.eclipse.collections.api.tuple.Pair;
|
||||
import org.eclipse.collections.impl.factory.Lists;
|
||||
import org.eclipse.collections.impl.tuple.Tuples;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ZipTest {
|
||||
|
||||
@Test
|
||||
public void whenZip_thenCorrect() {
|
||||
MutableList<String> numbers = Lists.mutable.with("1", "2", "3", "Ignored");
|
||||
MutableList<String> cars = Lists.mutable.with("Porsche", "Volvo", "Toyota");
|
||||
MutableList<Pair<String, String>> pairs = numbers.zip(cars);
|
||||
|
||||
assertEquals(Tuples.pair("1", "Porsche"), pairs.get(0));
|
||||
assertEquals(Tuples.pair("2", "Volvo"), pairs.get(1));
|
||||
assertEquals(Tuples.pair("3", "Toyota"), pairs.get(2));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user