java的list集合操作List<T>转化List<Long>
java的list集合操作List<T>转化List<Long> package com.google.common.collect;
import com.google.common.annotations.Beta;
import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.SortedSet;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable; @GwtCompatible(
emulated = true
)
public abstract class FluentIterable<E> implements Iterable<E> {
。。。。。
}
如下
List<SysDepartBook> departBooks = departBookManager.findByDepartId(sysDepart1.getDepartId());
List<Long> departSeeIds = FluentIterable.from(departBooks).transform(new Function<SysDepartBook, Long>() {
@Override
public Long apply(SysDepartBook p) {
return p.getDepartIdSee();
}
}).toList(); 、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
List<String> areaId = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(employeeReportForm.getAreaId());
package com.google.common.base; import com.google.common.annotations.Beta;
import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.CheckReturnValue; @GwtCompatible(
emulated = true
)
public final class Splitter {
。。。。。
} ==========================================
String fileIds = innerEntity.getFileIds();
List<String> fileIdStrList = StringUtil.splitString(fileIds);
// List<Long> list = JSONArray.parseArray(fileIds, Long.class);
List<Long> list = FluentIterable.from(fileIdStrList).transform(new Function<String, Long>() {
@Override
public Long apply(String p) {
return Long.parseLong(p);
}
}).toList(); List<Long> fids = new ArrayList<Long>();
HashSet hs1 = new HashSet(list);
HashSet hs2 = new HashSet(idList);
hs1.removeAll(hs2);
fids.addAll(hs1); String ids = Joiner.on(",").join(fids);
innerEntity.setFileIds(ids);
archiveInnerMapper.updateByPrimaryKeySelective(innerEntity);
java的list集合操作List<T>转化List<Long>的更多相关文章
- java中的集合操作类(未完待续)
申明: 实习生的肤浅理解,如发现有错误之处.还望大牛们多多指点 废话 事实上我写java的后台操作,我每次都会遇到一条语句:List<XXXXX> list = new ArrayList ...
- Java中常用集合操作
一.Map 名值对存储的. 常用派生类HashMap类 添加: put(key,value)往集合里添加数据 删除: clear()删除所有 remove(key)清除单个,根据k来找 获取: siz ...
- java中对集合操作的易错点01
今天用for循环遍历集合,对集合中满足条件的元素进行remove操作报错:ConcurrentModificationException 所以,在遍历集合进行增.删操作时,要使用迭代器的方式 publ ...
- JAVASE02-Unit04: 集合框架 、 集合操作 —— 线性表
Unit04: 集合框架 . 集合操作 -- 线性表 操作集合元素相关方法 package day04; import java.util.ArrayList; import java.util.Co ...
- JAVA中的集合容器操作类
目录 JAVA中的集合容器操作类 List集合 ArrayList的操作方法说明 LinkedList Stack Set Map Queue 总结 JAVA中的集合容器操作类 Java容器类库总共分 ...
- JAVA集合操作的利器:CollectionUtils
使用 CollectionUtils 中四个方法之一执行集合操作.这四种分别是 union(),intersection();disjunction(); subtract(); 下列例子就是演示了如 ...
- Java基础系列--集合之ArrayList
原创作品,可以转载,但是请标注出处地址:http://www.cnblogs.com/V1haoge/p/8494618.html 一.概述 ArrayList是Java集合体系中最常使用,也是最简单 ...
- 大数据技术之_16_Scala学习_08_数据结构(下)-集合操作+模式匹配
第十一章 数据结构(下)-集合操作11.1 集合元素的映射-map11.1.1 map 映射函数的操作11.1.2 高阶函数基本使用案例1+案例211.1.3 使用 map 映射函数来解决11.1.4 ...
- 第6节:Java基础 - 三大集合(上)
第6节:Java基础 - 三大集合(上) 本小节是Java基础篇章的第四小节,主要介绍Java中的常用集合知识点,涉及到的内容包括Java中的三大集合的引出,以及HashMap,Hashtable和C ...
随机推荐
- 关于SqlServer数据库C盘占用空间太大问题
工程需要用上了SQL SERVER2008 ,主要作为数据仓库使用,使用SSIS包从ORACEL10G中抽取数据到MS SQL中.环境是win2003x64的,驱动使用的oracle10gX64.使用 ...
- 使用 jQuery UI 和 jQuery 插件构建更好的 Web 应用程序
简介: 对于那些使用 JavaScript 和 jQuery 库从桌面应用程序转向 Web 应用程序的开发人员来说,他们还不习惯去考虑应用程序基本的外观,因为这些以前都是由操作系统来处理的.了解 jQ ...
- Charles安装包及破解包下载地址
Charles安装包及破解包下载地址 http://xclient.info/s/charles.html?_=baf317d2a9932afca9b32c327f8a34c9
- Qt学习之路(tip): parent参数
这是一篇很简单的文章,仅仅是用来说明一下一个参数的作用,因此我把它写成了tip,而不是接下来的17. 程序写的多了,你会发现几乎所有的Qt类的构造函数都会有一个parent参数.这个参数通常是QO ...
- 关于Unity中物理引擎的使用
物理引擎控制刚体,刚体上面贴上图片,所以看起来就是游戏运行起来的状态 物理世界计算刚体的运行状态,通过贴图显现出运算结果. 一.物理引擎 1:Unity 2D物理引擎基于Box2D封装而成;2: 物理 ...
- e679. 浮雕化图像
This example demonstrates a 3x3 kernel that embosses an image. Kernel kernel = new Kernel(3, 3, new ...
- 搭建局域网SVN代码服务器
1.安装Subversion,安装好后,在控制台输入“svn help”,如果成功安装,则会有很多命令打印输出:2.svnadmin create F:\Java_workspace\Reposito ...
- HttpHelper万能框架GetMergeCookie的问题
用万能框架写了一个DZ带验证码POST登录一直错误 http://www.sufeinet.com/thread-17795-1-1.html 调试半天发现是框架GetMergeCookie的问题,, ...
- 对ChemDraw Prime 16.0你了解多少
ChemDraw Prime 16.0应用是化学智能绘图程序的行业领导者.除了创建符合出版标准的绘图,化学家们可以使用ChemDraw Prime软件预测性能,搜索数据库等来节省时间,提高数据的准确性 ...
- [转] 在图标库中,找到合适的图标 ico
作者:xlrocket链接:https://www.zhihu.com/question/19857245/answer/241696797 在图标库中,找到合适的图标 或许,一些小伙伴会有收集图标的 ...