Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
matrix
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mall
arch
matrix
Commits
3a45a698
Commit
3a45a698
authored
Aug 13, 2019
by
haozi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加object判空工具类
parent
d2bf0929
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
112 additions
and
0 deletions
+112
-0
ObjectUtils.java
common-util/src/main/java/com/secoo/mall/common/util/object/ObjectUtils.java
+112
-0
No files found.
common-util/src/main/java/com/secoo/mall/common/util/object/ObjectUtils.java
0 → 100644
View file @
3a45a698
package
com
.
secoo
.
mall
.
common
.
util
.
object
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
/**
* Created by liumingming on 2018/6/13.
*/
public
class
ObjectUtils
{
/**
* 方法描述 如果对象为非空返回true 否则返回false
*/
public
static
<
T
>
boolean
isNotNull
(
T
obj
)
{
if
(
null
!=
obj
)
{
return
true
;
}
return
false
;
}
/**
* 方法描述 如果对象为空返回 true 否则返回false
*/
public
static
<
T
>
boolean
isNull
(
T
obj
)
{
if
(
null
!=
obj
)
{
return
false
;
}
return
true
;
}
/**
* 方法描述 判断Set集合非null 非空 返回true 否则返回false
*/
public
static
<
T
>
boolean
isNotNull
(
Set
<
T
>
list
)
{
if
(
null
!=
list
&&
!
list
.
isEmpty
())
{
return
true
;
}
return
false
;
}
/**
* 方法描述 判断Set集合是null或者空 非空 返回true 否则返回false
*/
public
static
<
T
>
boolean
isNull
(
Set
<
T
>
list
)
{
if
(
null
==
list
||
list
.
isEmpty
())
{
return
true
;
}
return
false
;
}
/**
* 方法描述 判断List集合非null 非空 返回true 否则返回false
*/
public
static
<
T
>
boolean
isNotNull
(
List
<
T
>
list
)
{
if
(
null
!=
list
&&
!
list
.
isEmpty
())
{
return
true
;
}
return
false
;
}
/**
* 方法描述 判断List集合是null或者空 非空 返回true 否则返回false
*/
public
static
<
T
>
boolean
isNull
(
List
<
T
>
list
)
{
if
(
null
==
list
||
list
.
isEmpty
())
{
return
true
;
}
return
false
;
}
/**
* 方法描述 判断Map集合非null 非空 返回true 否则返回false
*/
public
static
<
T
,
O
>
boolean
isNotNull
(
Map
<
T
,
O
>
map
)
{
if
(
null
!=
map
&&
!
map
.
isEmpty
())
{
return
true
;
}
return
false
;
}
/**
* 方法描述 判断Map集合是null或者空 返回true 否则返回false
*/
public
static
<
T
,
O
>
boolean
isNull
(
Map
<
T
,
O
>
map
)
{
if
(
null
==
map
||
map
.
isEmpty
())
{
return
true
;
}
return
false
;
}
/**
* 方法描述 判断数组集合非null 非空 返回true 否则返回false
*/
public
static
<
T
>
boolean
isNotNull
(
T
[]
list
)
{
if
(
null
!=
list
&&
!(
list
.
length
==
0
))
{
return
true
;
}
return
false
;
}
/**
* 方法描述 判断数组集合是null或者空 返回true 否则返回false
*/
public
static
<
T
>
boolean
isNull
(
T
[]
list
)
{
if
(
null
==
list
||
list
.
length
==
0
)
{
return
true
;
}
return
false
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment