diff --git a/libraries-apache-commons-collections/README.md b/libraries-apache-commons-collections/README.md new file mode 100644 index 0000000000..998ad1da09 --- /dev/null +++ b/libraries-apache-commons-collections/README.md @@ -0,0 +1,13 @@ +## Apache Commons Collections + +This module contains articles about Apache Commons Collections + +### Relevant articles + +- [Apache Commons Collections SetUtils](https://www.baeldung.com/apache-commons-setutils) +- [Apache Commons Collections OrderedMap](https://www.baeldung.com/apache-commons-ordered-map) +- [Guide to Apache Commons CircularFifoQueue](https://www.baeldung.com/commons-circular-fifo-queue) +- [Apache Commons Collections Bag](https://www.baeldung.com/apache-commons-bag) +- [A Guide to Apache Commons Collections CollectionUtils](https://www.baeldung.com/apache-commons-collection-utils) +- [Apache Commons Collections BidiMap](https://www.baeldung.com/commons-collections-bidi-map) +- [Apache Commons Collections MapUtils](https://www.baeldung.com/apache-commons-map-utils) \ No newline at end of file diff --git a/libraries-apache-commons-collections/pom.xml b/libraries-apache-commons-collections/pom.xml new file mode 100644 index 0000000000..eba0ad331e --- /dev/null +++ b/libraries-apache-commons-collections/pom.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + libraries-apache-commons-collections + libraries-apache-commons-collections + + + parent-modules + com.baeldung + 1.0.0-SNAPSHOT + + + + + org.apache.commons + commons-collections4 + ${commons.collections.version} + + + org.hamcrest + java-hamcrest + ${org.hamcrest.java-hamcrest.version} + test + + + org.assertj + assertj-core + ${assertj.version} + test + + + + + 4.1 + 3.6.2 + 2.0.0.0 + + + diff --git a/libraries-apache-commons/src/main/java/com/baeldung/commons/collectionutil/Address.java b/libraries-apache-commons-collections/src/main/java/com/baeldung/commons/collections/collectionutils/Address.java similarity index 94% rename from libraries-apache-commons/src/main/java/com/baeldung/commons/collectionutil/Address.java rename to libraries-apache-commons-collections/src/main/java/com/baeldung/commons/collections/collectionutils/Address.java index a1e231ec85..02c36a46f9 100644 --- a/libraries-apache-commons/src/main/java/com/baeldung/commons/collectionutil/Address.java +++ b/libraries-apache-commons-collections/src/main/java/com/baeldung/commons/collections/collectionutils/Address.java @@ -1,4 +1,4 @@ -package com.baeldung.commons.collectionutil; +package com.baeldung.commons.collections.collectionutils; public class Address { diff --git a/libraries-apache-commons/src/main/java/com/baeldung/commons/collectionutil/Customer.java b/libraries-apache-commons-collections/src/main/java/com/baeldung/commons/collections/collectionutils/Customer.java similarity index 97% rename from libraries-apache-commons/src/main/java/com/baeldung/commons/collectionutil/Customer.java rename to libraries-apache-commons-collections/src/main/java/com/baeldung/commons/collections/collectionutils/Customer.java index 1c6a8dc4f1..7d6db68474 100644 --- a/libraries-apache-commons/src/main/java/com/baeldung/commons/collectionutil/Customer.java +++ b/libraries-apache-commons-collections/src/main/java/com/baeldung/commons/collections/collectionutils/Customer.java @@ -1,4 +1,4 @@ -package com.baeldung.commons.collectionutil; +package com.baeldung.commons.collections.collectionutils; public class Customer implements Comparable { diff --git a/libraries-apache-commons/src/test/java/com/baeldung/commons/collections4/BagUnitTest.java b/libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/BagUnitTest.java similarity index 98% rename from libraries-apache-commons/src/test/java/com/baeldung/commons/collections4/BagUnitTest.java rename to libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/BagUnitTest.java index ebad4093f0..0877e6d4ac 100644 --- a/libraries-apache-commons/src/test/java/com/baeldung/commons/collections4/BagUnitTest.java +++ b/libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/BagUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.commons.collections4; +package com.baeldung.commons.collections; import org.apache.commons.collections4.Bag; import org.apache.commons.collections4.SortedBag; diff --git a/libraries-apache-commons/src/test/java/com/baeldung/commons/collections/BidiMapUnitTest.java b/libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/BidiMapUnitTest.java similarity index 100% rename from libraries-apache-commons/src/test/java/com/baeldung/commons/collections/BidiMapUnitTest.java rename to libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/BidiMapUnitTest.java diff --git a/libraries-apache-commons/src/test/java/com/baeldung/commons/collections/MapUtilsUnitTest.java b/libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/MapUtilsUnitTest.java similarity index 100% rename from libraries-apache-commons/src/test/java/com/baeldung/commons/collections/MapUtilsUnitTest.java rename to libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/MapUtilsUnitTest.java diff --git a/libraries-apache-commons/src/test/java/com/baeldung/commons/collections/SetUtilsUnitTest.java b/libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/SetUtilsUnitTest.java similarity index 100% rename from libraries-apache-commons/src/test/java/com/baeldung/commons/collections/SetUtilsUnitTest.java rename to libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/SetUtilsUnitTest.java diff --git a/libraries-apache-commons/src/test/java/com/baeldung/circularfifoqueue/CircularFifoQueueUnitTest.java b/libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/circularfifoqueue/CircularFifoQueueUnitTest.java similarity index 98% rename from libraries-apache-commons/src/test/java/com/baeldung/circularfifoqueue/CircularFifoQueueUnitTest.java rename to libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/circularfifoqueue/CircularFifoQueueUnitTest.java index 39384a7442..5664c7b44e 100644 --- a/libraries-apache-commons/src/test/java/com/baeldung/circularfifoqueue/CircularFifoQueueUnitTest.java +++ b/libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/circularfifoqueue/CircularFifoQueueUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.circularfifoqueue; +package com.baeldung.commons.collections.circularfifoqueue; import java.util.ArrayList; import java.util.List; diff --git a/libraries-apache-commons/src/test/java/com/baeldung/commons/collections/CollectionUtilsGuideUnitTest.java b/libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/collectionutils/CollectionUtilsGuideUnitTest.java similarity index 96% rename from libraries-apache-commons/src/test/java/com/baeldung/commons/collections/CollectionUtilsGuideUnitTest.java rename to libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/collectionutils/CollectionUtilsGuideUnitTest.java index 448c5b0729..e9a4612280 100644 --- a/libraries-apache-commons/src/test/java/com/baeldung/commons/collections/CollectionUtilsGuideUnitTest.java +++ b/libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/collectionutils/CollectionUtilsGuideUnitTest.java @@ -1,7 +1,7 @@ -package com.baeldung.commons.collections; +package com.baeldung.commons.collections.collectionutils; -import com.baeldung.commons.collectionutil.Address; -import com.baeldung.commons.collectionutil.Customer; +import com.baeldung.commons.collections.collectionutils.Address; +import com.baeldung.commons.collections.collectionutils.Customer; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.Predicate; import org.apache.commons.collections4.Transformer; diff --git a/libraries-apache-commons/src/test/java/com/baeldung/commons/collections/orderedmap/OrderedMapUnitTest.java b/libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/orderedmap/OrderedMapUnitTest.java similarity index 97% rename from libraries-apache-commons/src/test/java/com/baeldung/commons/collections/orderedmap/OrderedMapUnitTest.java rename to libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/orderedmap/OrderedMapUnitTest.java index c64143cba7..1ffc4a825f 100644 --- a/libraries-apache-commons/src/test/java/com/baeldung/commons/collections/orderedmap/OrderedMapUnitTest.java +++ b/libraries-apache-commons-collections/src/test/java/com/baeldung/commons/collections/orderedmap/OrderedMapUnitTest.java @@ -1,211 +1,211 @@ -package com.baeldung.commons.collections.orderedmap; - -import org.apache.commons.collections4.OrderedMap; -import org.apache.commons.collections4.OrderedMapIterator; -import org.apache.commons.collections4.map.LinkedMap; -import org.apache.commons.collections4.map.ListOrderedMap; -import org.junit.Before; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; - -public class OrderedMapUnitTest { - - private String[] names = { "Emily", "Mathew", "Rose", "John", "Anna" }; - private Integer[] ages = { 37, 28, 40, 36, 21 }; - - private int RUNNERS_COUNT = names.length; - - private OrderedMap runnersLinkedMap; - private OrderedMap runnersListOrderedMap; - - @Before - public void createRunners() { - // First implementation: ListOrderedMap - this.runnersListOrderedMap = new ListOrderedMap<>(); - this.loadOrderedMapOfRunners(this.runnersListOrderedMap); - - // Second implementation: LinkedMap - this.runnersLinkedMap = new LinkedMap<>(); - this.loadOrderedMapOfRunners(this.runnersLinkedMap); - } - - private void loadOrderedMapOfRunners(OrderedMap runners) { - for (int i = 0; i < RUNNERS_COUNT; i++) { - runners.put(this.names[i], this.ages[i]); - } - } - - @Test - public void givenALinkedMap_whenIteratedWithMapIterator_thenPreservesOrder() { - // Tests that the order in map iterator is the same - // as defined in the constant arrays of names and ages: - - OrderedMapIterator runnersIterator = this.runnersLinkedMap.mapIterator(); - int i = 0; - while (runnersIterator.hasNext()) { - runnersIterator.next(); - assertEquals(runnersIterator.getKey(), this.names[i]); - assertEquals(runnersIterator.getValue(), this.ages[i]); - i++; - } - } - - @Test - public void givenAListOrderedMap_whenIteratedWithMapIterator_thenPreservesOrder() { - // Tests that the order in map iterator is the same - // as defined in the constant arrays of names and ages: - - OrderedMapIterator runnersIterator = this.runnersListOrderedMap.mapIterator(); - int i = 0; - while (runnersIterator.hasNext()) { - runnersIterator.next(); - assertEquals(runnersIterator.getKey(), this.names[i]); - assertEquals(runnersIterator.getValue(), this.ages[i]); - i++; - } - } - - @Test - public void givenALinkedMap_whenIteratedForwards_thenPreservesOrder() { - // Tests that the order in the forward iteration is the same - // as defined in the constant arrays of names and ages - - String name = this.runnersLinkedMap.firstKey(); - int i = 0; - while (name != null) { - assertEquals(name, this.names[i]); - name = this.runnersLinkedMap.nextKey(name); - i++; - } - } - - @Test - public void givenAListOrderedMap_whenIteratedForwards_thenPreservesOrder() { - // Tests that the order in the forward iteration is the same - // as defined in the constant arrays of names and ages - - String name = this.runnersListOrderedMap.firstKey(); - int i = 0; - while (name != null) { - assertEquals(name, this.names[i]); - name = this.runnersListOrderedMap.nextKey(name); - i++; - } - } - - @Test - public void givenALinkedMap_whenIteratedBackwards_thenPreservesOrder() { - // Tests that the order in the backwards iteration is the same - // as defined in the constant arrays of names and ages - - String name = this.runnersLinkedMap.lastKey(); - int i = RUNNERS_COUNT - 1; - while (name != null) { - assertEquals(name, this.names[i]); - name = this.runnersLinkedMap.previousKey(name); - i--; - } - } - - @Test - public void givenAListOrderedMap_whenIteratedBackwards_thenPreservesOrder() { - // Tests that the order in the backwards iteration is the same - // as defined in the constant arrays of names and ages - - String name = this.runnersListOrderedMap.lastKey(); - int i = RUNNERS_COUNT - 1; - while (name != null) { - assertEquals(name, this.names[i]); - name = this.runnersListOrderedMap.previousKey(name); - i--; - } - } - - @Test - public void givenALinkedMap_whenObjectIsSearched_thenMatchesConstantArray() { - assertEquals(ages[4], this.runnersLinkedMap.get("Anna")); - } - - @Test - public void givenALinkedMap_whenConvertedToList_thenMatchesKeySet() { - // Casting the OrderedMap to a LinkedMap we can use asList() method - - LinkedMap lmap = (LinkedMap) this.runnersLinkedMap; - List listKeys = new ArrayList<>(); - listKeys.addAll(this.runnersLinkedMap.keySet()); - List linkedMap = lmap.asList(); - assertEquals(listKeys, linkedMap); - } - - @Test - public void givenALinkedMap_whenSearchByIndexIsUsed_thenMatchesConstantArray() { - LinkedMap lmap = (LinkedMap) this.runnersLinkedMap; - - for (int i = 0; i < RUNNERS_COUNT; i++) { - // accessed by index: - String name = lmap.get(i); - assertEquals(name, this.names[i]); - - // index of key concides with position in array - assertEquals(lmap.indexOf(this.names[i]), i); - } - } - - @Test - public void givenALinkedMap_whenElementRemoved_thenSizeDecrease() { - LinkedMap lmap = (LinkedMap) this.runnersLinkedMap; - Integer johnAge = lmap.remove("John");// by object - assertEquals(johnAge, new Integer(36)); - assertEquals(lmap.size(), RUNNERS_COUNT - 1); - - Integer emilyAge = lmap.remove(0);// by index - assertEquals(emilyAge, new Integer(37)); - assertEquals(lmap.size(), RUNNERS_COUNT - 2); - } - - @Test - public void givenAListOrderedMap_whenObjectIsSearched_thenMatchesConstantArray() { - assertEquals(ages[4], this.runnersListOrderedMap.get("Anna")); - } - - @Test - public void givenAListOrderedMap_whenConvertedToList_thenMatchesKeySet() { - ListOrderedMap lomap = (ListOrderedMap) this.runnersListOrderedMap; - List listKeys = new ArrayList<>(); - listKeys.addAll(this.runnersListOrderedMap.keySet()); - List lomapList = lomap.asList(); - assertEquals(listKeys, lomapList); - } - - @Test - public void givenAListOrderedMap_whenSearchByIndexIsUsed_thenMatchesConstantArray() { - ListOrderedMap lomap = (ListOrderedMap) this.runnersListOrderedMap; - - for (int i = 0; i < RUNNERS_COUNT; i++) { - // accessed by index: - String name = lomap.get(i); - assertEquals(name, this.names[i]); - - // index of key concides with position in array - assertEquals(lomap.indexOf(this.names[i]), i); - } - } - - @Test - public void givenAListOrderedMap_whenElementRemoved_thenSizeDecrease() { - ListOrderedMap lomap = (ListOrderedMap) this.runnersListOrderedMap; - - Integer johnAge = lomap.remove("John");// by object - - assertEquals(johnAge, new Integer(36)); - assertEquals(lomap.size(), RUNNERS_COUNT - 1); - - Integer emilyAge = lomap.remove(0);// by index - assertEquals(emilyAge, new Integer(37)); - assertEquals(lomap.size(), RUNNERS_COUNT - 2); - } -} +package com.baeldung.commons.collections.orderedmap; + +import org.apache.commons.collections4.OrderedMap; +import org.apache.commons.collections4.OrderedMapIterator; +import org.apache.commons.collections4.map.LinkedMap; +import org.apache.commons.collections4.map.ListOrderedMap; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.assertEquals; + +public class OrderedMapUnitTest { + + private String[] names = { "Emily", "Mathew", "Rose", "John", "Anna" }; + private Integer[] ages = { 37, 28, 40, 36, 21 }; + + private int RUNNERS_COUNT = names.length; + + private OrderedMap runnersLinkedMap; + private OrderedMap runnersListOrderedMap; + + @Before + public void createRunners() { + // First implementation: ListOrderedMap + this.runnersListOrderedMap = new ListOrderedMap<>(); + this.loadOrderedMapOfRunners(this.runnersListOrderedMap); + + // Second implementation: LinkedMap + this.runnersLinkedMap = new LinkedMap<>(); + this.loadOrderedMapOfRunners(this.runnersLinkedMap); + } + + private void loadOrderedMapOfRunners(OrderedMap runners) { + for (int i = 0; i < RUNNERS_COUNT; i++) { + runners.put(this.names[i], this.ages[i]); + } + } + + @Test + public void givenALinkedMap_whenIteratedWithMapIterator_thenPreservesOrder() { + // Tests that the order in map iterator is the same + // as defined in the constant arrays of names and ages: + + OrderedMapIterator runnersIterator = this.runnersLinkedMap.mapIterator(); + int i = 0; + while (runnersIterator.hasNext()) { + runnersIterator.next(); + assertEquals(runnersIterator.getKey(), this.names[i]); + assertEquals(runnersIterator.getValue(), this.ages[i]); + i++; + } + } + + @Test + public void givenAListOrderedMap_whenIteratedWithMapIterator_thenPreservesOrder() { + // Tests that the order in map iterator is the same + // as defined in the constant arrays of names and ages: + + OrderedMapIterator runnersIterator = this.runnersListOrderedMap.mapIterator(); + int i = 0; + while (runnersIterator.hasNext()) { + runnersIterator.next(); + assertEquals(runnersIterator.getKey(), this.names[i]); + assertEquals(runnersIterator.getValue(), this.ages[i]); + i++; + } + } + + @Test + public void givenALinkedMap_whenIteratedForwards_thenPreservesOrder() { + // Tests that the order in the forward iteration is the same + // as defined in the constant arrays of names and ages + + String name = this.runnersLinkedMap.firstKey(); + int i = 0; + while (name != null) { + assertEquals(name, this.names[i]); + name = this.runnersLinkedMap.nextKey(name); + i++; + } + } + + @Test + public void givenAListOrderedMap_whenIteratedForwards_thenPreservesOrder() { + // Tests that the order in the forward iteration is the same + // as defined in the constant arrays of names and ages + + String name = this.runnersListOrderedMap.firstKey(); + int i = 0; + while (name != null) { + assertEquals(name, this.names[i]); + name = this.runnersListOrderedMap.nextKey(name); + i++; + } + } + + @Test + public void givenALinkedMap_whenIteratedBackwards_thenPreservesOrder() { + // Tests that the order in the backwards iteration is the same + // as defined in the constant arrays of names and ages + + String name = this.runnersLinkedMap.lastKey(); + int i = RUNNERS_COUNT - 1; + while (name != null) { + assertEquals(name, this.names[i]); + name = this.runnersLinkedMap.previousKey(name); + i--; + } + } + + @Test + public void givenAListOrderedMap_whenIteratedBackwards_thenPreservesOrder() { + // Tests that the order in the backwards iteration is the same + // as defined in the constant arrays of names and ages + + String name = this.runnersListOrderedMap.lastKey(); + int i = RUNNERS_COUNT - 1; + while (name != null) { + assertEquals(name, this.names[i]); + name = this.runnersListOrderedMap.previousKey(name); + i--; + } + } + + @Test + public void givenALinkedMap_whenObjectIsSearched_thenMatchesConstantArray() { + assertEquals(ages[4], this.runnersLinkedMap.get("Anna")); + } + + @Test + public void givenALinkedMap_whenConvertedToList_thenMatchesKeySet() { + // Casting the OrderedMap to a LinkedMap we can use asList() method + + LinkedMap lmap = (LinkedMap) this.runnersLinkedMap; + List listKeys = new ArrayList<>(); + listKeys.addAll(this.runnersLinkedMap.keySet()); + List linkedMap = lmap.asList(); + assertEquals(listKeys, linkedMap); + } + + @Test + public void givenALinkedMap_whenSearchByIndexIsUsed_thenMatchesConstantArray() { + LinkedMap lmap = (LinkedMap) this.runnersLinkedMap; + + for (int i = 0; i < RUNNERS_COUNT; i++) { + // accessed by index: + String name = lmap.get(i); + assertEquals(name, this.names[i]); + + // index of key concides with position in array + assertEquals(lmap.indexOf(this.names[i]), i); + } + } + + @Test + public void givenALinkedMap_whenElementRemoved_thenSizeDecrease() { + LinkedMap lmap = (LinkedMap) this.runnersLinkedMap; + Integer johnAge = lmap.remove("John");// by object + assertEquals(johnAge, new Integer(36)); + assertEquals(lmap.size(), RUNNERS_COUNT - 1); + + Integer emilyAge = lmap.remove(0);// by index + assertEquals(emilyAge, new Integer(37)); + assertEquals(lmap.size(), RUNNERS_COUNT - 2); + } + + @Test + public void givenAListOrderedMap_whenObjectIsSearched_thenMatchesConstantArray() { + assertEquals(ages[4], this.runnersListOrderedMap.get("Anna")); + } + + @Test + public void givenAListOrderedMap_whenConvertedToList_thenMatchesKeySet() { + ListOrderedMap lomap = (ListOrderedMap) this.runnersListOrderedMap; + List listKeys = new ArrayList<>(); + listKeys.addAll(this.runnersListOrderedMap.keySet()); + List lomapList = lomap.asList(); + assertEquals(listKeys, lomapList); + } + + @Test + public void givenAListOrderedMap_whenSearchByIndexIsUsed_thenMatchesConstantArray() { + ListOrderedMap lomap = (ListOrderedMap) this.runnersListOrderedMap; + + for (int i = 0; i < RUNNERS_COUNT; i++) { + // accessed by index: + String name = lomap.get(i); + assertEquals(name, this.names[i]); + + // index of key concides with position in array + assertEquals(lomap.indexOf(this.names[i]), i); + } + } + + @Test + public void givenAListOrderedMap_whenElementRemoved_thenSizeDecrease() { + ListOrderedMap lomap = (ListOrderedMap) this.runnersListOrderedMap; + + Integer johnAge = lomap.remove("John");// by object + + assertEquals(johnAge, new Integer(36)); + assertEquals(lomap.size(), RUNNERS_COUNT - 1); + + Integer emilyAge = lomap.remove(0);// by index + assertEquals(emilyAge, new Integer(37)); + assertEquals(lomap.size(), RUNNERS_COUNT - 2); + } +} diff --git a/libraries-apache-commons-io/README.md b/libraries-apache-commons-io/README.md new file mode 100644 index 0000000000..d5f29499d2 --- /dev/null +++ b/libraries-apache-commons-io/README.md @@ -0,0 +1,7 @@ +## Apache Commons Collections + +This module contains articles about Apache Commons IO + +### Relevant articles +- [Apache Commons IO](https://www.baeldung.com/apache-commons-io) +- [Introduction to Apache Commons CSV](https://www.baeldung.com/apache-commons-csv) diff --git a/libraries-apache-commons-io/pom.xml b/libraries-apache-commons-io/pom.xml new file mode 100644 index 0000000000..7ec71d8264 --- /dev/null +++ b/libraries-apache-commons-io/pom.xml @@ -0,0 +1,31 @@ + + + 4.0.0 + libraries-apache-commons-io + libraries-apache-commons-io + + + parent-modules + com.baeldung + 1.0.0-SNAPSHOT + + + + + org.apache.commons + commons-csv + ${commons-csv.version} + + + commons-io + commons-io + ${commons-io.version} + + + + + 1.4 + + + diff --git a/libraries-apache-commons/src/main/java/com/baeldung/commons/io/FileMonitor.java b/libraries-apache-commons-io/src/main/java/com/baeldung/commons/io/FileMonitor.java similarity index 100% rename from libraries-apache-commons/src/main/java/com/baeldung/commons/io/FileMonitor.java rename to libraries-apache-commons-io/src/main/java/com/baeldung/commons/io/FileMonitor.java diff --git a/libraries-apache-commons/src/test/java/com/baeldung/commons/io/CommonsIOUnitTest.java b/libraries-apache-commons-io/src/test/java/com/baeldung/commons/io/CommonsIOUnitTest.java similarity index 100% rename from libraries-apache-commons/src/test/java/com/baeldung/commons/io/CommonsIOUnitTest.java rename to libraries-apache-commons-io/src/test/java/com/baeldung/commons/io/CommonsIOUnitTest.java diff --git a/libraries-apache-commons/src/test/java/com/baeldung/commons/csv/CSVReaderWriterUnitTest.java b/libraries-apache-commons-io/src/test/java/com/baeldung/commons/io/csv/CSVReaderWriterUnitTest.java similarity index 98% rename from libraries-apache-commons/src/test/java/com/baeldung/commons/csv/CSVReaderWriterUnitTest.java rename to libraries-apache-commons-io/src/test/java/com/baeldung/commons/io/csv/CSVReaderWriterUnitTest.java index f93e59ed75..b99f4e8bc3 100644 --- a/libraries-apache-commons/src/test/java/com/baeldung/commons/csv/CSVReaderWriterUnitTest.java +++ b/libraries-apache-commons-io/src/test/java/com/baeldung/commons/io/csv/CSVReaderWriterUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.commons.csv; +package com.baeldung.commons.io.csv; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVPrinter; diff --git a/libraries-apache-commons/src/test/resources/aaa.txt b/libraries-apache-commons-io/src/test/resources/aaa.txt similarity index 100% rename from libraries-apache-commons/src/test/resources/aaa.txt rename to libraries-apache-commons-io/src/test/resources/aaa.txt diff --git a/libraries-apache-commons/src/test/resources/book.csv b/libraries-apache-commons-io/src/test/resources/book.csv similarity index 100% rename from libraries-apache-commons/src/test/resources/book.csv rename to libraries-apache-commons-io/src/test/resources/book.csv diff --git a/libraries-apache-commons/src/test/resources/fileTest.txt b/libraries-apache-commons-io/src/test/resources/fileTest.txt similarity index 100% rename from libraries-apache-commons/src/test/resources/fileTest.txt rename to libraries-apache-commons-io/src/test/resources/fileTest.txt diff --git a/libraries-apache-commons/src/test/resources/sample.txt b/libraries-apache-commons-io/src/test/resources/sample.txt similarity index 100% rename from libraries-apache-commons/src/test/resources/sample.txt rename to libraries-apache-commons-io/src/test/resources/sample.txt diff --git a/libraries-apache-commons/.gitignore b/libraries-apache-commons/.gitignore deleted file mode 100644 index e594daf27a..0000000000 --- a/libraries-apache-commons/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -*.class - -# Folders # -/gensrc -/target - -# Packaged files # -*.jar -/bin/ diff --git a/libraries-apache-commons/README.md b/libraries-apache-commons/README.md index 01f2379588..ae424cb6c5 100644 --- a/libraries-apache-commons/README.md +++ b/libraries-apache-commons/README.md @@ -1,20 +1,11 @@ ### Relevant articles -- [Array Processing with Apache Commons Lang 3](http://www.baeldung.com/array-processing-commons-lang) -- [String Processing with Apache Commons Lang 3](http://www.baeldung.com/string-processing-commons-lang) -- [Introduction to Apache Commons Math](http://www.baeldung.com/apache-commons-math) -- [Apache Commons Collections SetUtils](http://www.baeldung.com/apache-commons-setutils) -- [Apache Commons Collections OrderedMap](http://www.baeldung.com/apache-commons-ordered-map) -- [Introduction to Apache Commons Text](http://www.baeldung.com/java-apache-commons-text) -- [A Guide to Apache Commons DbUtils](http://www.baeldung.com/apache-commons-dbutils) -- [Guide to Apache Commons CircularFifoQueue](http://www.baeldung.com/commons-circular-fifo-queue) -- [Apache Commons Chain](http://www.baeldung.com/apache-commons-chain) -- [Introduction to Apache Commons CSV](http://www.baeldung.com/apache-commons-csv) -- [Apache Commons IO](http://www.baeldung.com/apache-commons-io) -- [Apache Commons Collections Bag](http://www.baeldung.com/apache-commons-bag) -- [A Guide to Apache Commons Collections CollectionUtils](http://www.baeldung.com/apache-commons-collection-utils) -- [Apache Commons BeanUtils](http://www.baeldung.com/apache-commons-beanutils) -- [Apache Commons Collections BidiMap](http://www.baeldung.com/commons-collections-bidi-map) -- [Apache Commons Collections MapUtils](http://www.baeldung.com/apache-commons-map-utils) -- [Histograms with Apache Commons Frequency](http://www.baeldung.com/apache-commons-frequency) +- [Array Processing with Apache Commons Lang 3](https://www.baeldung.com/array-processing-commons-lang) +- [String Processing with Apache Commons Lang 3](https://www.baeldung.com/string-processing-commons-lang) +- [Introduction to Apache Commons Math](https://www.baeldung.com/apache-commons-math) +- [Introduction to Apache Commons Text](https://www.baeldung.com/java-apache-commons-text) +- [A Guide to Apache Commons DbUtils](https://www.baeldung.com/apache-commons-dbutils) +- [Apache Commons Chain](https://www.baeldung.com/apache-commons-chain) +- [Apache Commons BeanUtils](https://www.baeldung.com/apache-commons-beanutils) +- [Histograms with Apache Commons Frequency](https://www.baeldung.com/apache-commons-frequency) - [An Introduction to Apache Commons Lang 3](https://www.baeldung.com/java-commons-lang-3) \ No newline at end of file diff --git a/libraries-apache-commons/pom.xml b/libraries-apache-commons/pom.xml index 05d11d83fe..f83a8c7304 100644 --- a/libraries-apache-commons/pom.xml +++ b/libraries-apache-commons/pom.xml @@ -32,21 +32,11 @@ commons-text ${commons-text.version} - - commons-io - commons-io - ${commons-io.version} - commons-chain commons-chain ${commons-chain.version} - - org.apache.commons - commons-csv - ${commons-csv.version} - commons-dbutils commons-dbutils @@ -72,18 +62,6 @@ xchart ${xchart-version} - - org.apache.commons - commons-collections4 - ${commons.collections.version} - - - org.hamcrest - java-hamcrest - ${org.hamcrest.java-hamcrest.version} - test - - @@ -91,11 +69,8 @@ 1.1 1.9.3 1.2 - 1.4 3.6.2 1.6 - 4.1 - 2.0.0.0 1.10.L001 3.5.2 3.6 diff --git a/pom.xml b/pom.xml index 89786496c7..3c335f82bd 100644 --- a/pom.xml +++ b/pom.xml @@ -530,6 +530,8 @@ libraries-data libraries-data-2 libraries-apache-commons + libraries-apache-commons-collections + libraries-apache-commons-io libraries-primitive libraries-testing libraries-security @@ -1266,6 +1268,8 @@ libraries-data libraries-data-2 libraries-apache-commons + libraries-apache-commons-collections + libraries-apache-commons-io libraries-testing libraries-security libraries-server