@@ -1045,7 +1045,7 @@ public List<Object> pull(Object... values) {
1045
1045
}
1046
1046
1047
1047
public static List <Object > pullAt (final List <Object > list , final Integer ... indexes ) {
1048
- final List <Object > result = newArrayList ();
1048
+ final List <Object > result = new ArrayList <> ();
1049
1049
final List <Integer > indexesList = Arrays .asList (indexes );
1050
1050
int index = 0 ;
1051
1051
for (final Iterator <Object > iterator = list .iterator (); iterator .hasNext (); ) {
@@ -1065,7 +1065,7 @@ public List<Object> pullAt(final Integer... indexes) {
1065
1065
}
1066
1066
1067
1067
public static <T > List <T > remove (final List <T > list , final Predicate <T > pred ) {
1068
- final List <T > result = newArrayList ();
1068
+ final List <T > result = new ArrayList <> ();
1069
1069
for (final Iterator <T > iterator = list .iterator (); iterator .hasNext (); ) {
1070
1070
final T object = iterator .next ();
1071
1071
if (pred .test (object )) {
@@ -1149,7 +1149,7 @@ public List<T> xor(final List<T> list) {
1149
1149
}
1150
1150
1151
1151
public static <T > List <T > at (final List <T > list , final Integer ... indexes ) {
1152
- final List <T > result = newArrayList ();
1152
+ final List <T > result = new ArrayList <> ();
1153
1153
final List <Integer > indexesList = Arrays .asList (indexes );
1154
1154
int index = 0 ;
1155
1155
for (final T object : list ) {
@@ -1874,7 +1874,7 @@ public static <T> T remove(final Map<String, Object> object, final List<String>
1874
1874
1875
1875
public static Map <String , Object > rename (
1876
1876
final Map <String , Object > map , final String oldKey , final String newKey ) {
1877
- Map <String , Object > outMap = newLinkedHashMap ();
1877
+ Map <String , Object > outMap = new LinkedHashMap <> ();
1878
1878
for (Map .Entry <String , Object > entry : map .entrySet ()) {
1879
1879
if (entry .getKey ().equals (oldKey )) {
1880
1880
outMap .put (newKey , makeObjectForRename (entry .getValue (), oldKey , newKey ));
@@ -1890,7 +1890,7 @@ private static Object makeObjectForRename(
1890
1890
Object value , final String oldKey , final String newKey ) {
1891
1891
final Object result ;
1892
1892
if (value instanceof List ) {
1893
- List <Object > values = newArrayList ();
1893
+ List <Object > values = new ArrayList <> ();
1894
1894
for (Object item : (List ) value ) {
1895
1895
values .add (
1896
1896
item instanceof Map
@@ -1915,7 +1915,7 @@ public static Map<String, Object> setValue(
1915
1915
final Map <String , Object > map ,
1916
1916
final String key ,
1917
1917
final BiFunction <String , Object , Object > newValue ) {
1918
- Map <String , Object > outMap = newLinkedHashMap ();
1918
+ Map <String , Object > outMap = new LinkedHashMap <> ();
1919
1919
for (Map .Entry <String , Object > entry : map .entrySet ()) {
1920
1920
if (entry .getKey ().equals (key )) {
1921
1921
outMap .put (
@@ -1934,7 +1934,7 @@ private static Object makeObjectForSetValue(
1934
1934
Object value , final String key , final BiFunction <String , Object , Object > newValue ) {
1935
1935
final Object result ;
1936
1936
if (value instanceof List ) {
1937
- List <Object > values = newArrayList ();
1937
+ List <Object > values = new ArrayList <> ();
1938
1938
for (Object item : (List ) value ) {
1939
1939
values .add (
1940
1940
item instanceof Map
@@ -1952,7 +1952,7 @@ private static Object makeObjectForSetValue(
1952
1952
1953
1953
public static Map <String , Object > update (
1954
1954
final Map <String , Object > map1 , final Map <String , Object > map2 ) {
1955
- Map <String , Object > outMap = newLinkedHashMap ();
1955
+ Map <String , Object > outMap = new LinkedHashMap <> ();
1956
1956
for (Map .Entry <String , Object > entry : map1 .entrySet ()) {
1957
1957
String key = entry .getKey ();
1958
1958
Object value2 = entry .getValue ();
@@ -2309,7 +2309,7 @@ && nonNull(timeBetweenRetry)
2309
2309
}
2310
2310
2311
2311
public static List <String > explode (final String input ) {
2312
- List <String > result = newArrayList ();
2312
+ List <String > result = new ArrayList <> ();
2313
2313
if (isNull (input )) {
2314
2314
return result ;
2315
2315
}
@@ -2511,22 +2511,10 @@ public List<List<T>> createPermutationWithRepetition(final int permutationLength
2511
2511
return createPermutationWithRepetition ((List <T >) value (), permutationLength );
2512
2512
}
2513
2513
2514
- protected static <T > List <T > newArrayList () {
2515
- return Underscore .newArrayList ();
2516
- }
2517
-
2518
2514
protected static <T > List <T > newArrayList (final Iterable <T > iterable ) {
2519
2515
return Underscore .newArrayList (iterable );
2520
2516
}
2521
2517
2522
- protected static <T > Set <T > newLinkedHashSet () {
2523
- return Underscore .newLinkedHashSet ();
2524
- }
2525
-
2526
- protected static <K , E > Map <K , E > newLinkedHashMap () {
2527
- return Underscore .newLinkedHashMap ();
2528
- }
2529
-
2530
2518
public static <T > String join (final Iterable <T > iterable , final String separator ) {
2531
2519
return Underscore .join (iterable , separator );
2532
2520
}
@@ -2615,7 +2603,7 @@ private static Map<String, Object> getStringObjectMap(Object object) {
2615
2603
if (object instanceof Map ) {
2616
2604
result = (Map <String , Object >) object ;
2617
2605
} else {
2618
- result = newLinkedHashMap ();
2606
+ result = new LinkedHashMap <> ();
2619
2607
result .put ("value" , object );
2620
2608
}
2621
2609
return result ;
@@ -2652,7 +2640,7 @@ public static String jsonToXml(
2652
2640
newRootName );
2653
2641
} else if (mode == JsonToXmlMode .ADD_ROOT
2654
2642
&& !Xml .XmlValue .getMapKey (object ).equals (ROOT )) {
2655
- final Map <String , Object > map = U . newLinkedHashMap ();
2643
+ final Map <String , Object > map = new LinkedHashMap <> ();
2656
2644
map .put (newRootName , object );
2657
2645
result = Xml .toXml (map , identStep );
2658
2646
} else if (mode == JsonToXmlMode .REMOVE_ARRAY_ATTRIBUTE ) {
@@ -2863,7 +2851,7 @@ public static String changeXmlEncoding(String xml, String encoding) {
2863
2851
}
2864
2852
2865
2853
public static Map <String , Object > removeMinusesAndConvertNumbers (Map <String , Object > map ) {
2866
- Map <String , Object > outMap = newLinkedHashMap ();
2854
+ Map <String , Object > outMap = new LinkedHashMap <> ();
2867
2855
for (Map .Entry <String , Object > entry : map .entrySet ()) {
2868
2856
final String newKey ;
2869
2857
if (entry .getKey ().startsWith ("-" )) {
@@ -2883,7 +2871,7 @@ public static Map<String, Object> removeMinusesAndConvertNumbers(Map<String, Obj
2883
2871
private static Object makeObject (Object value ) {
2884
2872
final Object result ;
2885
2873
if (value instanceof List ) {
2886
- List <Object > values = newArrayList ();
2874
+ List <Object > values = new ArrayList <> ();
2887
2875
for (Object item : (List ) value ) {
2888
2876
values .add (
2889
2877
item instanceof Map
@@ -2947,7 +2935,7 @@ public static Map<String, Object> replaceSelfClosingWithEmpty(Map<String, Object
2947
2935
2948
2936
@ SuppressWarnings ("unchecked" )
2949
2937
public static Object replaceSelfClosingWithValue (Map <String , Object > map , String value ) {
2950
- Object outMap = newLinkedHashMap ();
2938
+ Object outMap = new LinkedHashMap <> ();
2951
2939
for (Map .Entry <String , Object > entry : map .entrySet ()) {
2952
2940
if (selfClosing .equals (entry .getKey ()) && "true" .equals (entry .getValue ())) {
2953
2941
if (map .size () == 1 ) {
@@ -2968,7 +2956,7 @@ public static Object replaceSelfClosingWithValue(Map<String, Object> map, String
2968
2956
private static Object makeObjectSelfClose (Object value , String newValue ) {
2969
2957
final Object result ;
2970
2958
if (value instanceof List ) {
2971
- List <Object > values = newArrayList ();
2959
+ List <Object > values = new ArrayList <> ();
2972
2960
for (Object item : (List ) value ) {
2973
2961
values .add (
2974
2962
item instanceof Map
@@ -2988,7 +2976,7 @@ public static Map<String, Object> replaceEmptyValueWithNull(Map<String, Object>
2988
2976
if (map == null || map .isEmpty ()) {
2989
2977
return null ;
2990
2978
}
2991
- Map <String , Object > outMap = newLinkedHashMap ();
2979
+ Map <String , Object > outMap = new LinkedHashMap <> ();
2992
2980
for (Map .Entry <String , Object > entry : map .entrySet ()) {
2993
2981
outMap .put (String .valueOf (entry .getKey ()), makeObjectEmptyValue (entry .getValue ()));
2994
2982
}
@@ -2999,7 +2987,7 @@ public static Map<String, Object> replaceEmptyValueWithNull(Map<String, Object>
2999
2987
private static Object makeObjectEmptyValue (Object value ) {
3000
2988
final Object result ;
3001
2989
if (value instanceof List ) {
3002
- List <Object > values = newArrayList ();
2990
+ List <Object > values = new ArrayList <> ();
3003
2991
for (Object item : (List ) value ) {
3004
2992
values .add (item instanceof Map ? replaceEmptyValueWithNull ((Map ) item ) : item );
3005
2993
}
@@ -3016,7 +3004,7 @@ public static Object replaceEmptyValueWithEmptyString(Map<String, Object> map) {
3016
3004
if (map .isEmpty ()) {
3017
3005
return "" ;
3018
3006
}
3019
- Map <String , Object > outMap = newLinkedHashMap ();
3007
+ Map <String , Object > outMap = new LinkedHashMap <> ();
3020
3008
for (Map .Entry <String , Object > entry : map .entrySet ()) {
3021
3009
outMap .put (String .valueOf (entry .getKey ()), makeObjectEmptyString (entry .getValue ()));
3022
3010
}
@@ -3027,7 +3015,7 @@ public static Object replaceEmptyValueWithEmptyString(Map<String, Object> map) {
3027
3015
private static Object makeObjectEmptyString (Object value ) {
3028
3016
final Object result ;
3029
3017
if (value instanceof List ) {
3030
- List <Object > values = newArrayList ();
3018
+ List <Object > values = new ArrayList <> ();
3031
3019
for (Object item : (List ) value ) {
3032
3020
values .add (
3033
3021
item instanceof Map ? replaceEmptyValueWithEmptyString ((Map ) item ) : item );
@@ -3042,7 +3030,7 @@ private static Object makeObjectEmptyString(Object value) {
3042
3030
}
3043
3031
3044
3032
public static Map <String , Object > forceAttributeUsage (Map <String , Object > map ) {
3045
- Map <String , Object > outMap = newLinkedHashMap ();
3033
+ Map <String , Object > outMap = new LinkedHashMap <> ();
3046
3034
for (Map .Entry <String , Object > entry : map .entrySet ()) {
3047
3035
outMap .put (
3048
3036
entry .getValue () instanceof Map
@@ -3059,7 +3047,7 @@ public static Map<String, Object> forceAttributeUsage(Map<String, Object> map) {
3059
3047
private static Object makeAttributeUsage (Object value ) {
3060
3048
final Object result ;
3061
3049
if (value instanceof List ) {
3062
- List <Object > values = newArrayList ();
3050
+ List <Object > values = new ArrayList <> ();
3063
3051
for (Object item : (List ) value ) {
3064
3052
values .add (item instanceof Map ? forceAttributeUsage ((Map ) item ) : item );
3065
3053
}
@@ -3073,12 +3061,12 @@ private static Object makeAttributeUsage(Object value) {
3073
3061
}
3074
3062
3075
3063
public static Map <String , Object > replaceNullWithEmptyValue (Map <String , Object > map ) {
3076
- Map <String , Object > outMap = newLinkedHashMap ();
3064
+ Map <String , Object > outMap = new LinkedHashMap <> ();
3077
3065
for (Map .Entry <String , Object > entry : map .entrySet ()) {
3078
3066
outMap .put (
3079
3067
entry .getKey (),
3080
3068
entry .getValue () == null
3081
- ? newLinkedHashMap ()
3069
+ ? new LinkedHashMap <> ()
3082
3070
: makeReplaceNullValue (entry .getValue ()));
3083
3071
}
3084
3072
return outMap ;
@@ -3088,7 +3076,7 @@ public static Map<String, Object> replaceNullWithEmptyValue(Map<String, Object>
3088
3076
private static Object makeReplaceNullValue (Object value ) {
3089
3077
final Object result ;
3090
3078
if (value instanceof List ) {
3091
- List <Object > values = newArrayList ();
3079
+ List <Object > values = new ArrayList <> ();
3092
3080
for (Object item : (List ) value ) {
3093
3081
values .add (item instanceof Map ? replaceNullWithEmptyValue ((Map ) item ) : item );
3094
3082
}
@@ -3102,12 +3090,12 @@ private static Object makeReplaceNullValue(Object value) {
3102
3090
}
3103
3091
3104
3092
public static Map <String , Object > replaceEmptyStringWithEmptyValue (Map <String , Object > map ) {
3105
- Map <String , Object > outMap = newLinkedHashMap ();
3093
+ Map <String , Object > outMap = new LinkedHashMap <> ();
3106
3094
for (Map .Entry <String , Object > entry : map .entrySet ()) {
3107
3095
outMap .put (
3108
3096
entry .getKey (),
3109
3097
"" .equals (entry .getValue ())
3110
- ? newLinkedHashMap ()
3098
+ ? new LinkedHashMap <> ()
3111
3099
: makeReplaceEmptyString (entry .getValue ()));
3112
3100
}
3113
3101
return outMap ;
@@ -3117,7 +3105,7 @@ public static Map<String, Object> replaceEmptyStringWithEmptyValue(Map<String, O
3117
3105
private static Object makeReplaceEmptyString (Object value ) {
3118
3106
final Object result ;
3119
3107
if (value instanceof List ) {
3120
- List <Object > values = newArrayList ();
3108
+ List <Object > values = new ArrayList <> ();
3121
3109
for (Object item : (List ) value ) {
3122
3110
values .add (
3123
3111
item instanceof Map ? replaceEmptyStringWithEmptyValue ((Map ) item ) : item );
@@ -3132,7 +3120,7 @@ private static Object makeReplaceEmptyString(Object value) {
3132
3120
}
3133
3121
3134
3122
public static Map <String , Object > replaceNumberAndBooleanWithString (Map <String , Object > map ) {
3135
- Map <String , Object > outMap = newLinkedHashMap ();
3123
+ Map <String , Object > outMap = new LinkedHashMap <> ();
3136
3124
for (Map .Entry <String , Object > entry : map .entrySet ()) {
3137
3125
outMap .put (
3138
3126
entry .getKey (),
@@ -3147,7 +3135,7 @@ public static Map<String, Object> replaceNumberAndBooleanWithString(Map<String,
3147
3135
private static Object makeReplaceNumberAndBoolean (Object value ) {
3148
3136
final Object result ;
3149
3137
if (value instanceof List ) {
3150
- List <Object > values = newArrayList ();
3138
+ List <Object > values = new ArrayList <> ();
3151
3139
for (Object item : (List ) value ) {
3152
3140
if (item instanceof Map ) {
3153
3141
values .add (replaceNumberAndBooleanWithString ((Map ) item ));
@@ -3174,7 +3162,7 @@ public static Map<String, Object> replaceFirstLevel(Map<String, Object> map) {
3174
3162
3175
3163
@ SuppressWarnings ("unchecked" )
3176
3164
public static Map <String , Object > replaceFirstLevel (Map <String , Object > map , int level ) {
3177
- Map <String , Object > outMap = newLinkedHashMap ();
3165
+ Map <String , Object > outMap = new LinkedHashMap <> ();
3178
3166
for (Map .Entry <String , Object > entry : map .entrySet ()) {
3179
3167
outMap .put (entry .getKey (), makeReplaceFirstLevel (entry .getValue (), level + 1 ));
3180
3168
}
@@ -3193,7 +3181,7 @@ public static Map<String, Object> replaceFirstLevel(Map<String, Object> map, int
3193
3181
private static Object makeReplaceFirstLevel (Object value , int level ) {
3194
3182
final Object result ;
3195
3183
if (value instanceof List ) {
3196
- List <Object > values = newArrayList ();
3184
+ List <Object > values = new ArrayList <> ();
3197
3185
for (Object item : (List ) value ) {
3198
3186
values .add (item instanceof Map ? replaceFirstLevel ((Map ) item , level + 1 ) : item );
3199
3187
}
@@ -3207,7 +3195,7 @@ private static Object makeReplaceFirstLevel(Object value, int level) {
3207
3195
}
3208
3196
3209
3197
public static Map <String , Object > replaceNilWithNull (Map <String , Object > map ) {
3210
- Map <String , Object > outMap = newLinkedHashMap ();
3198
+ Map <String , Object > outMap = new LinkedHashMap <> ();
3211
3199
for (Map .Entry <String , Object > entry : map .entrySet ()) {
3212
3200
Object outValue = makeReplaceNilWithNull (entry .getValue ());
3213
3201
if (outValue instanceof Map
@@ -3227,7 +3215,7 @@ public static Map<String, Object> replaceNilWithNull(Map<String, Object> map) {
3227
3215
private static Object makeReplaceNilWithNull (Object value ) {
3228
3216
final Object result ;
3229
3217
if (value instanceof List ) {
3230
- List <Object > values = newArrayList ();
3218
+ List <Object > values = new ArrayList <> ();
3231
3219
for (Object item : (List ) value ) {
3232
3220
values .add (item instanceof Map ? replaceNilWithNull ((Map ) item ) : item );
3233
3221
}
@@ -3241,7 +3229,7 @@ private static Object makeReplaceNilWithNull(Object value) {
3241
3229
}
3242
3230
3243
3231
public static Map <String , Object > deepCopyMap (Map <String , Object > map ) {
3244
- Map <String , Object > outMap = newLinkedHashMap ();
3232
+ Map <String , Object > outMap = new LinkedHashMap <> ();
3245
3233
for (Map .Entry <String , Object > entry : map .entrySet ()) {
3246
3234
outMap .put (entry .getKey (), makeDeepCopyMap (entry .getValue ()));
3247
3235
}
@@ -3252,7 +3240,7 @@ public static Map<String, Object> deepCopyMap(Map<String, Object> map) {
3252
3240
private static Object makeDeepCopyMap (Object value ) {
3253
3241
final Object result ;
3254
3242
if (value instanceof List ) {
3255
- List <Object > values = newArrayList ();
3243
+ List <Object > values = new ArrayList <> ();
3256
3244
for (Object item : (List ) value ) {
3257
3245
values .add (item instanceof Map ? deepCopyMap ((Map ) item ) : item );
3258
3246
}
@@ -3273,7 +3261,7 @@ public static class Builder {
3273
3261
private final Map <String , Object > data ;
3274
3262
3275
3263
public Builder () {
3276
- data = newLinkedHashMap ();
3264
+ data = new LinkedHashMap <> ();
3277
3265
}
3278
3266
3279
3267
public Builder add (final String key , final Object value ) {
@@ -3406,7 +3394,7 @@ public static class ArrayBuilder {
3406
3394
private final List <Object > data ;
3407
3395
3408
3396
public ArrayBuilder () {
3409
- data = newArrayList ();
3397
+ data = new ArrayList <> ();
3410
3398
}
3411
3399
3412
3400
public ArrayBuilder add (final Object value ) {
0 commit comments