containutil.java
来自「struts 2 核心包 的源码 有错误是难免的」· Java 代码 · 共 53 行
JAVA
53 行
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: ContainUtil.java
package org.apache.struts2.util;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Map;
public class ContainUtil
{
public ContainUtil()
{
}
public static boolean contains(Object obj1, Object obj2)
{
if (obj1 == null || obj2 == null)
return false;
if (obj1 instanceof Map)
{
if (((Map)obj1).containsKey(obj2))
return true;
} else
if (obj1 instanceof Collection)
{
if (((Collection)obj1).contains(obj2) || ((Collection)obj1).contains(obj2.toString()))
return true;
} else
if (obj1.getClass().isArray())
{
for (int i = 0; i < Array.getLength(obj1); i++)
{
Object value = null;
value = Array.get(obj1, i);
if (value.equals(obj2))
return true;
}
} else
{
if (obj1.toString().equals(obj2.toString()))
return true;
if (obj1.equals(obj2))
return true;
}
return false;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?