//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void convertCollectionToLongArray() internal virtual void ConvertCollectionToLongArray() { PrimitiveIntSet heapSet = PrimitiveIntCollections.AsSet(new int[] { 1, 2, 3 }); PrimitiveIntSet offHeapIntSet = Primitive.OffHeapIntSet(GlobalMemoryTracker.INSTANCE); offHeapIntSet.Add(7); offHeapIntSet.Add(8); assertArrayEquals(new long[] { 1, 2, 3 }, PrimitiveIntCollections.AsLongArray(heapSet)); assertArrayEquals(new long[] { 7, 8 }, PrimitiveIntCollections.AsLongArray(offHeapIntSet)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void filter() internal virtual void Filter() { // GIVEN PrimitiveIntIterator items = PrimitiveIntCollections.Iterator(1, 2, 3); // WHEN PrimitiveIntIterator filtered = PrimitiveIntCollections.Filter(items, item => item != 2); // THEN AssertItems(filtered, 1, 3); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void arrayOfItemsAsIterator() internal virtual void ArrayOfItemsAsIterator() { // GIVEN int[] items = new int[] { 2, 5, 234 }; // WHEN PrimitiveIntIterator iterator = PrimitiveIntCollections.Iterator(items); // THEN AssertItems(iterator, items); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldDeduplicate() internal virtual void ShouldDeduplicate() { // GIVEN int[] array = new int[] { 1, 6, 2, 5, 6, 1, 6 }; // WHEN int[] deduped = PrimitiveIntCollections.Deduplicate(array); // THEN assertArrayEquals(new int[] { 1, 6, 2, 5 }, deduped); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void deduplicate() internal virtual void Deduplicate() { // GIVEN PrimitiveIntIterator items = PrimitiveIntCollections.Iterator(1, 1, 2, 3, 2); // WHEN PrimitiveIntIterator deduped = PrimitiveIntCollections.Deduplicate(items); // THEN AssertItems(deduped, 1, 2, 3); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void concatenateTwoIterators() internal virtual void ConcatenateTwoIterators() { // GIVEN PrimitiveIntIterator firstItems = PrimitiveIntCollections.Iterator(10, 3, 203, 32); PrimitiveIntIterator otherItems = PrimitiveIntCollections.Iterator(1, 2, 5); // WHEN PrimitiveIntIterator iterator = PrimitiveIntCollections.Concat(asList(firstItems, otherItems).GetEnumerator()); // THEN AssertItems(iterator, 10, 3, 203, 32, 1, 2, 5); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void copyMap() internal virtual void CopyMap() { PrimitiveIntObjectMap <object> originalMap = Primitive.IntObjectMap(); originalMap.Put(1, "a"); originalMap.Put(2, "b"); originalMap.Put(3, "c"); PrimitiveIntObjectMap <object> copyMap = PrimitiveIntCollections.Copy(originalMap); assertNotSame(originalMap, copyMap); assertEquals(3, copyMap.Size()); assertEquals("a", copyMap.Get(1)); assertEquals("b", copyMap.Get(2)); assertEquals("c", copyMap.Get(3)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void iteratorAsSet() internal virtual void IteratorAsSet() { // GIVEN PrimitiveIntIterator items = PrimitiveIntCollections.Iterator(1, 2, 3); // WHEN PrimitiveIntSet set = PrimitiveIntCollections.AsSet(items); // THEN assertTrue(set.Contains(1)); assertTrue(set.Contains(2)); assertTrue(set.Contains(3)); assertFalse(set.Contains(4)); assertThrows(typeof(System.InvalidOperationException), () => PrimitiveIntCollections.AsSet(PrimitiveIntCollections.Iterator(1, 2, 1))); }