Skip to content

Commit 8f5c9af

Browse files
committed
Finish 9.7.0
2 parents c5cd317 + d1ff71d commit 8f5c9af

File tree

18 files changed

+657
-392
lines changed

18 files changed

+657
-392
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ repositories {
1616
}
1717
1818
dependencies {
19-
compile 'com.spaceshift:rlib.common:9.6.0'
20-
compile 'com.spaceshift:rlib.fx:9.6.0'
21-
compile 'com.spaceshift:rlib.network:9.6.0'
22-
compile 'com.spaceshift:rlib.mail:9.6.0'
23-
compile 'com.spaceshift:rlib.testcontainers:9.6.0'
19+
compile 'com.spaceshift:rlib.common:9.7.0'
20+
compile 'com.spaceshift:rlib.fx:9.7.0'
21+
compile 'com.spaceshift:rlib.network:9.7.0'
22+
compile 'com.spaceshift:rlib.mail:9.7.0'
23+
compile 'com.spaceshift:rlib.testcontainers:9.7.0'
2424
}
2525
```
2626

@@ -41,27 +41,27 @@ dependencies {
4141
<dependency>
4242
<groupId>com.spaceshift</groupId>
4343
<artifactId>rlib.common</artifactId>
44-
<version>9.6.0</version>
44+
<version>9.7.0</version>
4545
</dependency>
4646
<dependency>
4747
<groupId>com.spaceshift</groupId>
4848
<artifactId>rlib.fx</artifactId>
49-
<version>9.6.0</version>
49+
<version>9.7.0</version>
5050
</dependency>
5151
<dependency>
5252
<groupId>com.spaceshift</groupId>
5353
<artifactId>rlib.network</artifactId>
54-
<version>9.6.0</version>
54+
<version>9.7.0</version>
5555
</dependency>
5656
<dependency>
5757
<groupId>com.spaceshift</groupId>
5858
<artifactId>rlib.mail</artifactId>
59-
<version>9.6.0</version>
59+
<version>9.7.0</version>
6060
</dependency>
6161
<dependency>
6262
<groupId>com.spaceshift</groupId>
6363
<artifactId>rlib.testcontainers</artifactId>
64-
<version>9.6.0</version>
64+
<version>9.7.0</version>
6565
</dependency>
6666

6767
```

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
}
99
}
1010

11-
rootProject.version = '9.6.0'
11+
rootProject.version = '9.7.0'
1212
group = 'com.spaceshift'
1313

1414
allprojects {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.ss.rlib.common.function;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
5+
/**
6+
* @author JavaSaBr
7+
*/
8+
@FunctionalInterface
9+
public interface NotNullIntBiObjectConsumer<S, T> extends IntBiObjectConsumer<S, T> {
10+
11+
@Override
12+
void accept(int first, @NotNull S second, @NotNull T third);
13+
}

rlib-common/src/main/java/com/ss/rlib/common/util/ArrayUtils.java

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.ss.rlib.common.function.*;
44
import com.ss.rlib.common.util.array.Array;
5-
import com.ss.rlib.common.util.array.ConcurrentArray;
65
import com.ss.rlib.common.util.array.IntegerArray;
76
import com.ss.rlib.common.util.array.LongArray;
87
import org.jetbrains.annotations.NotNull;
@@ -103,7 +102,7 @@ public final class ArrayUtils {
103102

104103
int length = array.length;
105104

106-
array = copyOf(array, 1);
105+
array = copyOfAndExtend(array, 1);
107106
array[length] = element;
108107

109108
return array;
@@ -332,15 +331,15 @@ public static boolean contains(@NotNull Object[] array, @NotNull Object object)
332331
}
333332

334333
/**
335-
* Copy and extend if need a native array.
334+
* Copy an array and extend if need.
336335
*
337336
* @param <T> the array component's type.
338337
* @param original the original array.
339-
* @param added the added size.
340-
* @return the new copied native array.
338+
* @param added the additional size.
339+
* @return the new copied array.
341340
*/
342341
@SuppressWarnings("unchecked")
343-
public static <T> @NotNull T[] copyOf(@NotNull T[] original, int added) {
342+
public static <T> @NotNull T[] copyOfAndExtend(@NotNull T[] original, int added) {
344343
return Arrays.copyOf(original, original.length + added);
345344
}
346345

@@ -437,16 +436,8 @@ public static void copyTo(
437436
* @param to the last element.
438437
* @return the new array.
439438
*/
440-
public static <T> @NotNull T[] copyOfRange(@NotNull final T[] original, final int from, final int to) {
441-
442-
final Class<? extends Object[]> newType = original.getClass();
443-
final int newLength = to - from;
444-
445-
final T[] copy = ClassUtils.unsafeCast(create(newType.getComponentType(), newLength));
446-
447-
System.arraycopy(original, from, copy, 0, Math.min(original.length - from, newLength));
448-
449-
return copy;
439+
public static <T> @NotNull T[] copyOfRange(@NotNull T[] original, int from, int to) {
440+
return Arrays.copyOfRange(original, from, to);
450441
}
451442

452443
/**

rlib-common/src/main/java/com/ss/rlib/common/util/NumberUtils.java

Lines changed: 78 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -13,73 +13,6 @@
1313
*/
1414
public final class NumberUtils {
1515

16-
/**
17-
* Bytes to int int.
18-
*
19-
* @param array the array
20-
* @param offset the offset
21-
* @param bigEndian the big endian
22-
* @return the int
23-
*/
24-
@Deprecated(forRemoval = true)
25-
public static int bytesToInt(@NotNull byte[] array, int offset, boolean bigEndian) {
26-
27-
if (bigEndian) {
28-
return makeInt(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);
29-
}
30-
31-
return makeInt(array[offset + 3], array[offset + 2], array[offset + 1], array[offset]);
32-
}
33-
34-
/**
35-
* Bytes to u int long.
36-
*
37-
* @param array the array
38-
* @param offset the offset
39-
* @param bigEndian the big endian
40-
* @return the long
41-
*/
42-
@Deprecated(forRemoval = true)
43-
public static long bytesToUInt(@NotNull byte[] array, int offset, boolean bigEndian) {
44-
45-
long value = 0;
46-
47-
if (bigEndian) {
48-
value = makeInt(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);
49-
} else {
50-
value = makeInt(array[offset + 3], array[offset + 2], array[offset + 1], array[offset]);
51-
}
52-
53-
return value & 0xFFFFFFFFL;
54-
}
55-
56-
/**
57-
* Make int int.
58-
*
59-
* @param byte1 the byte 1
60-
* @param byte2 the byte 2
61-
* @param byte3 the byte 3
62-
* @param byte4 the byte 4
63-
* @return the int
64-
*/
65-
@Deprecated(forRemoval = true)
66-
public static int makeInt(byte byte1, byte byte2, byte byte3, byte byte4) {
67-
return (byte4 & 0xFF) << 24 | (byte3 & 0xFF) << 16 | (byte2 & 0xFF) << 8 | byte1 & 0xFF;
68-
}
69-
70-
/**
71-
* Make long long.
72-
*
73-
* @param bytes the bytes
74-
* @return the long
75-
*/
76-
@Deprecated(forRemoval = true)
77-
public static long makeLong(@NotNull byte[] bytes) {
78-
return ((long) bytes[7] & 0xFF) << 56 | ((long) bytes[6] & 0xFF) << 48 | ((long) bytes[5] & 0xFF) << 40 |
79-
((long) bytes[4] & 0xFF) << 32 | ((long) bytes[3] & 0xFF) << 24 | ((long) bytes[2] & 0xFF) << 16 |
80-
((long) bytes[1] & 0xFF) << 8 | (long) bytes[0] & 0xFF;
81-
}
82-
8316
/**
8417
* Get a short value from a byte array.
8518
*
@@ -402,6 +335,84 @@ public static boolean toBoolean(
402335
}
403336
}
404337

338+
/**
339+
* Returns {@code true} if the numbers are equal to each other
340+
* and {@code false} otherwise.
341+
*
342+
* @param first the first number.
343+
* @param second the second number to be compared with {@code first} for equality.
344+
* @return {@code true} if the arguments are equal to each other and {@code false} otherwise.
345+
* @since 9.7.0
346+
*/
347+
public static boolean equals(byte first, byte second) {
348+
return first == second;
349+
}
350+
351+
/**
352+
* Returns {@code true} if the numbers are equal to each other
353+
* and {@code false} otherwise.
354+
*
355+
* @param first the first number.
356+
* @param second the second number to be compared with {@code first} for equality.
357+
* @return {@code true} if the arguments are equal to each other and {@code false} otherwise.
358+
* @since 9.7.0
359+
*/
360+
public static boolean equals(short first, short second) {
361+
return first == second;
362+
}
363+
364+
/**
365+
* Returns {@code true} if the numbers are equal to each other
366+
* and {@code false} otherwise.
367+
*
368+
* @param first the first number.
369+
* @param second the second number to be compared with {@code first} for equality.
370+
* @return {@code true} if the arguments are equal to each other and {@code false} otherwise.
371+
* @since 9.7.0
372+
*/
373+
public static boolean equals(int first, int second) {
374+
return first == second;
375+
}
376+
377+
/**
378+
* Returns {@code true} if the numbers are equal to each other
379+
* and {@code false} otherwise.
380+
*
381+
* @param first the first number.
382+
* @param second the second number to be compared with {@code first} for equality.
383+
* @return {@code true} if the arguments are equal to each other and {@code false} otherwise.
384+
* @since 9.7.0
385+
*/
386+
public static boolean equals(long first, long second) {
387+
return first == second;
388+
}
389+
390+
/**
391+
* Returns {@code true} if the numbers are equal to each other
392+
* and {@code false} otherwise.
393+
*
394+
* @param first the first number.
395+
* @param second the second number to be compared with {@code first} for equality.
396+
* @return {@code true} if the arguments are equal to each other and {@code false} otherwise.
397+
* @since 9.7.0
398+
*/
399+
public static boolean equals(float first, float second) {
400+
return first == second;
401+
}
402+
403+
/**
404+
* Returns {@code true} if the numbers are equal to each other
405+
* and {@code false} otherwise.
406+
*
407+
* @param first the first number.
408+
* @param second the second number to be compared with {@code first} for equality.
409+
* @return {@code true} if the arguments are equal to each other and {@code false} otherwise.
410+
* @since 9.7.0
411+
*/
412+
public static boolean equals(double first, double second) {
413+
return first == second;
414+
}
415+
405416
private NumberUtils() {
406417
throw new IllegalArgumentException();
407418
}

0 commit comments

Comments
 (0)