src/main/java/com/zandero/utils/MapUtils.java
public static <K, V> List<Map<K, V>> split(Map<K, V> map, int limit) {

		Assert.notNull(map, "Missing map!");
		Assert.isTrue(limit > 0, "Map limit must be > 0!");

		if (map.size() <= limit) {
			return Collections.singletonList(map); // nothing to do
		}

		return map.entrySet().parallelStream().collect(mapSizer(limit));
	}
public static <K, V> List<Map<K, V>> split(Map<K, V> map, int limit) {

		Assert.notNull(map, "Missing map!");
		Assert.isTrue(limit > 0, "Map limit must be > 0!");

		if (map.size() <= limit) {
			return Collections.singletonList(map); // nothing to do
		}

		return map.entrySet().parallelStream().collect(mapSizer(limit));
	}
public static < K , V > List < Map < K , V > > split ( Map < K , V > map , int limit ) { Assert . notNull ( map , "Missing map!" ) ; Assert . isTrue ( limit > 0 , "Map limit must be > 0!" ) ; if ( map . size ( ) <= limit ) { return Collections . singletonList ( map ) ; // nothing to do } return map . entrySet ( ) . parallelStream ( ) . collect ( mapSizer ( limit ) ) ; }
Splits map to list of maps
@param map to be split
@param limit max number of items in splitted map
@param <K> key type
@param <V> value type
@return list of maps
Splits map to list of maps