Merge remote-tracking branch 'origin/v6-dev' into v6-dev

This commit is contained in:
wenlianggong
2024-08-22 20:46:18 +08:00
1765 changed files with 2217 additions and 1766 deletions

View File

@@ -0,0 +1,41 @@
package org.dromara.hutool.core.bean.copier;
import org.dromara.hutool.core.bean.BeanUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.util.HashMap;
import java.util.Map;
/**
* setFieldValueEditor编辑后的值理应继续判断ignoreNullValue
*/
public class Issue3702Test {
@Test
void mapToMapTest() {
final Map<String,String> map= new HashMap<>();
map.put("a","");
map.put("b","b");
map.put("c","c");
map.put("d","d");
final Map<String,String> map2= new HashMap<>();
map2.put("a","a1");
map2.put("b","b1");
map2.put("c","c1");
map2.put("d","d1");
final CopyOptions option= CopyOptions.of()
.setIgnoreNullValue(true)
.setIgnoreError(true)
.setFieldEditor((entry)->{
if(ObjUtil.equals(entry.getValue(), "")){
entry.setValue(null);
}
return entry;
});
BeanUtil.copyProperties(map,map2,option);
Assertions.assertEquals("{a=a1, b=b, c=c, d=d}", map2.toString());
}
}

View File

@@ -0,0 +1,55 @@
package org.dromara.hutool.core.map;
import org.dromara.hutool.core.map.multi.DirectedWeightGraph;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.util.Map;
/**
* @author newshiJ
*/
public class DirectedWeightGraphTest {
@Test
@Disabled
public void test1() {
final DirectedWeightGraph<String> graph = new DirectedWeightGraph<>();
graph.putEdge("A", "B", 14);
graph.putEdge("A", "C", 8);
graph.putEdge("A", "D", 12);
// graph.putEdge("B", "A", -14);
graph.putEdge("B", "E", 4);
graph.putEdge("C", "B", 3);
graph.putEdge("C", "D", 5);
graph.putEdge("C", "E", 5);
graph.putEdge("C", "F", 6);
graph.putEdge("D", "F", 7);
// graph.putEdge("E", "B", -14);
graph.putEdge("E", "G", 4);
graph.putEdge("G", "B", -9);
graph.putEdge("F", "G", 2);
graph.putEdge("X", "Y", 2);
graph.removePoint("X");
System.out.println(graph);
Map<String, DirectedWeightGraph.Path<String>> map = null;
try {
map = graph.bestPathMap("A");
map.forEach((k, v) -> {
System.out.println(v);
});
} catch (final DirectedWeightGraph.NegativeRingException e) {
e.printStackTrace();
}
}
}