mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-08-18 20:38:02 +08:00
fix code
This commit is contained in:
@@ -121,11 +121,10 @@ public class AnnotationUtil {
|
|||||||
if (ArrayUtil.isEmpty(t.getParameterTypes())) {
|
if (ArrayUtil.isEmpty(t.getParameterTypes())) {
|
||||||
// 只读取无参方法
|
// 只读取无参方法
|
||||||
final String name = t.getName();
|
final String name = t.getName();
|
||||||
if ("hashCode".equals(name) || "toString".equals(name) || "annotationType".equals(name)) {
|
|
||||||
// 跳过自有的几个方法
|
// 跳过自有的几个方法
|
||||||
return false;
|
return (false == "hashCode".equals(name)) //
|
||||||
}
|
&& (false == "toString".equals(name)) //
|
||||||
return true;
|
&& (false == "annotationType".equals(name));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -18,11 +18,11 @@ public class ArrayIter<E> implements Iterator<E>, Iterable<E>, Serializable{
|
|||||||
/** 数组 */
|
/** 数组 */
|
||||||
private Object array;
|
private Object array;
|
||||||
/** 起始位置 */
|
/** 起始位置 */
|
||||||
private int startIndex = 0;
|
private int startIndex;
|
||||||
/** 结束位置 */
|
/** 结束位置 */
|
||||||
private int endIndex = 0;
|
private int endIndex;
|
||||||
/** 当前位置 */
|
/** 当前位置 */
|
||||||
private int index = 0;
|
private int index;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造
|
* 构造
|
||||||
|
@@ -35,7 +35,7 @@ public class BoundedPriorityQueue<E> extends PriorityQueue<E>{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(E o1, E o2) {
|
public int compare(E o1, E o2) {
|
||||||
int cResult = 0;
|
int cResult;
|
||||||
if(comparator != null) {
|
if(comparator != null) {
|
||||||
cResult = comparator.compare(o1, o2);
|
cResult = comparator.compare(o1, o2);
|
||||||
}else {
|
}else {
|
||||||
|
@@ -25,7 +25,6 @@ import java.util.List;
|
|||||||
public class CopiedIter<E> implements Iterator<E>, Iterable<E>, Serializable {
|
public class CopiedIter<E> implements Iterator<E>, Iterable<E>, Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private List<E> eleList = new LinkedList<>();
|
|
||||||
private Iterator<E> listIterator;
|
private Iterator<E> listIterator;
|
||||||
|
|
||||||
public static <V> CopiedIter<V> copyOf(Iterator<V> iterator){
|
public static <V> CopiedIter<V> copyOf(Iterator<V> iterator){
|
||||||
@@ -37,9 +36,7 @@ public class CopiedIter<E> implements Iterator<E>, Iterable<E>, Serializable {
|
|||||||
* @param iterator 被复制的Iterator
|
* @param iterator 被复制的Iterator
|
||||||
*/
|
*/
|
||||||
public CopiedIter(Iterator<E> iterator) {
|
public CopiedIter(Iterator<E> iterator) {
|
||||||
while (iterator.hasNext()) {
|
final List<E> eleList = CollUtil.newArrayList(iterator);
|
||||||
eleList.add(iterator.next());
|
|
||||||
}
|
|
||||||
this.listIterator = eleList.iterator();
|
this.listIterator = eleList.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -376,7 +376,7 @@ public class IterUtil {
|
|||||||
* @return Map
|
* @return Map
|
||||||
*/
|
*/
|
||||||
public static <K, V> HashMap<K, V> toMap(Iterable<Entry<K, V>> entryIter) {
|
public static <K, V> HashMap<K, V> toMap(Iterable<Entry<K, V>> entryIter) {
|
||||||
final HashMap<K, V> map = new HashMap<K, V>();
|
final HashMap<K, V> map = new HashMap<>();
|
||||||
if (isNotEmpty(entryIter)) {
|
if (isNotEmpty(entryIter)) {
|
||||||
for (Entry<K, V> entry : entryIter) {
|
for (Entry<K, V> entry : entryIter) {
|
||||||
map.put(entry.getKey(), entry.getValue());
|
map.put(entry.getKey(), entry.getValue());
|
||||||
@@ -500,7 +500,7 @@ public class IterUtil {
|
|||||||
* @return {@link Iterator}
|
* @return {@link Iterator}
|
||||||
*/
|
*/
|
||||||
public static <E> Iterator<E> asIterator(Enumeration<E> e) {
|
public static <E> Iterator<E> asIterator(Enumeration<E> e) {
|
||||||
return new EnumerationIter<E>(e);
|
return new EnumerationIter<>(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -571,15 +571,12 @@ public class IterUtil {
|
|||||||
*/
|
*/
|
||||||
public static Class<?> getElementType(Iterator<?> iterator) {
|
public static Class<?> getElementType(Iterator<?> iterator) {
|
||||||
final Iterator<?> iter2 = new CopiedIter<>(iterator);
|
final Iterator<?> iter2 = new CopiedIter<>(iterator);
|
||||||
if (null != iter2) {
|
if (iter2.hasNext()) {
|
||||||
Object t;
|
final Object t = iter2.next();
|
||||||
while (iter2.hasNext()) {
|
|
||||||
t = iter2.next();
|
|
||||||
if (null != t) {
|
if (null != t) {
|
||||||
return t.getClass();
|
return t.getClass();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user