mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix code
This commit is contained in:
parent
3f678427b3
commit
b0ed5bea9a
@ -8,7 +8,7 @@ import java.io.PushbackInputStream;
|
||||
|
||||
/**
|
||||
* 读取带BOM头的流内容,{@code getCharset()}方法调用后会得到BOM头的编码,且会去除BOM头<br>
|
||||
* BOM定义:http://www.unicode.org/unicode/faq/utf_bom.html<br>
|
||||
* BOM定义:<a href="http://www.unicode.org/unicode/faq/utf_bom.html">http://www.unicode.org/unicode/faq/utf_bom.html</a><br>
|
||||
* <ul>
|
||||
* <li>00 00 FE FF = UTF-32, big-endian</li>
|
||||
* <li>FF FE 00 00 = UTF-32, little-endian</li>
|
||||
@ -24,7 +24,7 @@ import java.io.PushbackInputStream;
|
||||
* enc = uin.getCharset(); // check and skip possible BOM bytes
|
||||
* </code>
|
||||
* <br><br>
|
||||
* 参考: http://akini.mbnet.fi/java/unicodereader/UnicodeInputStream.java.txt
|
||||
* 参考: <a href="http://akini.mbnet.fi/java/unicodereader/UnicodeInputStream.java.txt">http://www.unicode.org/unicode/faq/utf_bom.html</a>
|
||||
*
|
||||
* @author looly
|
||||
*/
|
||||
|
@ -5,9 +5,9 @@ import java.util.zip.Checksum;
|
||||
|
||||
/**
|
||||
* CRC8 循环冗余校验码(Cyclic Redundancy Check)实现<br>
|
||||
* 代码来自:https://github.com/BBSc0der
|
||||
* 代码来自:<a href="https://github.com/BBSc0der">https://github.com/BBSc0der</a>
|
||||
*
|
||||
* @author Bolek,Looly
|
||||
* @author Bolek, Looly
|
||||
* @since 4.4.1
|
||||
*/
|
||||
public class CRC8 implements Checksum, Serializable {
|
||||
@ -47,7 +47,7 @@ public class CRC8 implements Checksum, Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the current checksum with the specified array of bytes. Equivalent to calling <code>update(buffer, 0, buffer.length)</code>.
|
||||
* Updates the current checksum with the specified array of bytes. Equivalent to calling {@code update(buffer, 0, buffer.length)}.
|
||||
*
|
||||
* @param buffer the byte array to update the checksum with
|
||||
*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.hutool.core.tree;
|
||||
|
||||
import cn.hutool.core.collection.iter.IterUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.tree.parser.DefaultNodeParser;
|
||||
import cn.hutool.core.tree.parser.NodeParser;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
@ -150,7 +150,7 @@ public class TreeUtil {
|
||||
* @since 5.7.2
|
||||
*/
|
||||
public static <E> Tree<E> buildSingle(final Map<E, Tree<E>> map, final E rootId) {
|
||||
final Tree<E> tree = IterUtil.getFirstNoneNull(map.values());
|
||||
final Tree<E> tree = CollUtil.getFirstNoneNull(map.values());
|
||||
if (null != tree) {
|
||||
final TreeNodeConfig config = tree.getConfig();
|
||||
return TreeBuilder.of(rootId, config)
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.hutool.core.collection;
|
||||
|
||||
import cn.hutool.core.collection.iter.IterUtil;
|
||||
import cn.hutool.core.comparator.ComparableComparator;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Console;
|
||||
@ -721,7 +722,7 @@ public class CollUtilTest {
|
||||
@Test
|
||||
public void toMapTest() {
|
||||
final Collection<String> keys = ListUtil.of("a", "b", "c", "d");
|
||||
final Map<String, String> map = CollUtil.toMap(keys, new HashMap<>(), (value) -> "key" + value);
|
||||
final Map<String, String> map = IterUtil.toMap(keys, (value) -> "key" + value);
|
||||
Assert.assertEquals("a", map.get("keya"));
|
||||
Assert.assertEquals("b", map.get("keyb"));
|
||||
Assert.assertEquals("c", map.get("keyc"));
|
||||
@ -735,8 +736,7 @@ public class CollUtilTest {
|
||||
oldMap.put("b", "12");
|
||||
oldMap.put("c", "134");
|
||||
|
||||
final Map<String, Long> map = CollUtil.toMap(oldMap.entrySet(),
|
||||
new HashMap<>(),
|
||||
final Map<String, Long> map = IterUtil.toMap(oldMap.entrySet(),
|
||||
Map.Entry::getKey,
|
||||
entry -> Long.parseLong(entry.getValue()));
|
||||
|
||||
|
@ -25,7 +25,7 @@ public class IterUtilTest {
|
||||
@Test
|
||||
public void getFirstNonNullTest() {
|
||||
final ArrayList<String> strings = ListUtil.of(null, null, "123", "456", null);
|
||||
Assert.assertEquals("123", IterUtil.getFirstNoneNull(strings));
|
||||
Assert.assertEquals("123", CollUtil.getFirstNoneNull(strings));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user