Skip to content

Commit d70329a

Browse files
committed
1.70
1 parent fc20f1e commit d70329a

File tree

5 files changed

+74
-3
lines changed

5 files changed

+74
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package dev.felnull.fnjl;
22

33
public class FNJLBuildIn {
4-
protected static final String VERSION = "1.69";
4+
protected static final String VERSION = "1.70";
55
}

common/src/main/java/dev/felnull/fnjl/util/FNArrayUtil.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
import java.util.Arrays;
44
import java.util.Objects;
55

6+
/**
7+
* 配列関連
8+
*
9+
* @author MORIMORI0317
10+
* @since 1.57
11+
*/
612
public class FNArrayUtil {
713
/**
814
* 配列の最後に値を追加
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package dev.felnull.fnjl.util;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
5+
import java.util.HashSet;
6+
import java.util.Map;
7+
import java.util.Set;
8+
import java.util.function.BiPredicate;
9+
import java.util.function.Predicate;
10+
11+
/**
12+
* コレクション関連
13+
*
14+
* @author MORIMORI0317
15+
* @since 1.70
16+
*/
17+
public class FNCollectionUtils {
18+
/**
19+
* 条件に一致するキーとエントリーを削除する
20+
*
21+
* @param map 対象MAP
22+
* @param filter フィルター
23+
* @param <K> キー
24+
* @param <E> エントリー
25+
*/
26+
public static <K, E> void removeIfKeyPredicate(@NotNull Map<K, E> map, @NotNull Predicate<K> filter) {
27+
Set<K> delKeys = new HashSet<>();
28+
map.forEach((key, entry) -> {
29+
if (filter.test(key)) delKeys.add(key);
30+
});
31+
delKeys.forEach(map::remove);
32+
}
33+
34+
/**
35+
* 条件に一致するキーとエントリーを削除する
36+
*
37+
* @param map 対象MAP
38+
* @param filter フィルター
39+
* @param <K> キー
40+
* @param <E> エントリー
41+
*/
42+
public static <K, E> void removeIfEntryPredicate(Map<K, E> map, Predicate<E> filter) {
43+
Set<K> delKeys = new HashSet<>();
44+
map.forEach((key, entry) -> {
45+
if (filter.test(entry)) delKeys.add(key);
46+
});
47+
delKeys.forEach(map::remove);
48+
}
49+
50+
/**
51+
* 条件に一致するキーとエントリーを削除する
52+
*
53+
* @param map 対象MAP
54+
* @param filter フィルター
55+
* @param <K> キー
56+
* @param <E> エントリー
57+
*/
58+
public static <K, E> void removeIf(Map<K, E> map, BiPredicate<K, E> filter) {
59+
Set<K> delKyes = new HashSet<>();
60+
map.forEach((key, entry) -> {
61+
if (filter.test(key, entry)) delKyes.add(key);
62+
});
63+
delKyes.forEach(map::remove);
64+
}
65+
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
fnjl_group=dev.felnull
22
fnjl_name=felnull-java-library
3-
fnjl_version=1.69
3+
fnjl_version=1.70
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package dev.felnull.fnjln;
22

33
public class FNJLNBuildIn {
4-
protected static final String VERSION = "1.69";
4+
protected static final String VERSION = "1.70";
55

66
protected static final int NATIVE_LIBRARY_VERSION = 1;
77
}

0 commit comments

Comments
 (0)