Skip to content

Commit 53cbd56

Browse files
committed
List工具类
1 parent 3ec4009 commit 53cbd56

File tree

1 file changed

+50
-0
lines changed
  • api-boot-project/api-boot-common/src/main/java/org/minbox/framework/api/boot/common/tools

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright [2019] [恒宇少年 - 于起宇]
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
package org.minbox.framework.api.boot.common.tools;
19+
20+
import java.util.ArrayList;
21+
import java.util.List;
22+
23+
/**
24+
* list tools
25+
*
26+
* @author:恒宇少年 - 于起宇
27+
* <p>
28+
* DateTime:2019-04-20 11:25
29+
* Blog:http://blog.yuqiyu.com
30+
* WebSite:http://www.jianshu.com/u/092df3f77bca
31+
* Gitee:https://gitee.com/hengboy
32+
* GitHub:https://github.com/hengboy
33+
*/
34+
public class ListTools {
35+
/**
36+
* value converter to list
37+
*
38+
* @param value
39+
* @return
40+
*/
41+
public static List<String> convertToList(Object value) {
42+
List<String> resourceUrls = new ArrayList<>();
43+
if (value instanceof List) {
44+
resourceUrls.addAll((List) value);
45+
} else {
46+
resourceUrls.add(String.valueOf(value));
47+
}
48+
return resourceUrls;
49+
}
50+
}

0 commit comments

Comments
 (0)