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>的更多相关文章

  1. java中的集合操作类(未完待续)

    申明: 实习生的肤浅理解,如发现有错误之处.还望大牛们多多指点 废话 事实上我写java的后台操作,我每次都会遇到一条语句:List<XXXXX> list = new ArrayList ...

  2. Java中常用集合操作

    一.Map 名值对存储的. 常用派生类HashMap类 添加: put(key,value)往集合里添加数据 删除: clear()删除所有 remove(key)清除单个,根据k来找 获取: siz ...

  3. java中对集合操作的易错点01

    今天用for循环遍历集合,对集合中满足条件的元素进行remove操作报错:ConcurrentModificationException 所以,在遍历集合进行增.删操作时,要使用迭代器的方式 publ ...

  4. JAVASE02-Unit04: 集合框架 、 集合操作 —— 线性表

    Unit04: 集合框架 . 集合操作 -- 线性表 操作集合元素相关方法 package day04; import java.util.ArrayList; import java.util.Co ...

  5. JAVA中的集合容器操作类

    目录 JAVA中的集合容器操作类 List集合 ArrayList的操作方法说明 LinkedList Stack Set Map Queue 总结 JAVA中的集合容器操作类 Java容器类库总共分 ...

  6. JAVA集合操作的利器:CollectionUtils

    使用 CollectionUtils 中四个方法之一执行集合操作.这四种分别是 union(),intersection();disjunction(); subtract(); 下列例子就是演示了如 ...

  7. Java基础系列--集合之ArrayList

    原创作品,可以转载,但是请标注出处地址:http://www.cnblogs.com/V1haoge/p/8494618.html 一.概述 ArrayList是Java集合体系中最常使用,也是最简单 ...

  8. 大数据技术之_16_Scala学习_08_数据结构(下)-集合操作+模式匹配

    第十一章 数据结构(下)-集合操作11.1 集合元素的映射-map11.1.1 map 映射函数的操作11.1.2 高阶函数基本使用案例1+案例211.1.3 使用 map 映射函数来解决11.1.4 ...

  9. 第6节:Java基础 - 三大集合(上)

    第6节:Java基础 - 三大集合(上) 本小节是Java基础篇章的第四小节,主要介绍Java中的常用集合知识点,涉及到的内容包括Java中的三大集合的引出,以及HashMap,Hashtable和C ...

随机推荐

  1. 在Ubuntu中安装PHP,MySQL,Nginx和phpMyAdmin

    apt install php apt-get install php7.0 apt-get -y install php7.0-fpm 缺少 mysqli 扩展.请检查 PHP 配置. apt in ...

  2. 上手并过渡到PHP7(2)——必须传递int, string, bool参数?没问题

    Type hints, Type safe 泊学实操视频 泊学原文链接PHP 7中最引人注目的新特性之一,无疑是Scalar type hints.我们可以在函数参数和返回值中使用scalar typ ...

  3. 自然语言交流系统 phxnet团队 创新实训 个人博客 (一)

    项目涉及链表操作,遂整理: 使用链表结构可以克服数组链表需要预先知道数据大小的缺点,链表结构可以充分利用计算机内存空间,实现灵活的内存动态管理.但是链表失去了数组随机读取的优点,同时链表由于增加了结点 ...

  4. selenium测试(Java)--学习总结

  5. awk基础命令

    1. 命令awk简介 a. awk是一种编程语言,用于对文本和数据进行处理. b.具有强大得文本格式话能力 c.利用命令awk,可以将一些文本整理成需要的格式. d.命令awk是逐行进行处理的 2. ...

  6. 【转】【WPF】IvalueConverter和TypeConverter

    简要说明: IValueConverter主要用于XAML绑定和数据源之间的转换 TypeConverter主要用于自定义类的属性类型之间的转换 本文主要讲解如何使用IValueConverter和T ...

  7. e645. 处理键盘事件

    You can get the key that was pressed either as a key character (which is a Unicode character) or as ...

  8. e552. 取Applet的参数

    An applet can be configured through the use of applet parameters. For example, the contents for a ne ...

  9. linux -- Ubuntu 命令技巧合集

    http://www.nenew.net/UbuntuSkills.html#.E6.9F.A5.E7.9C.8B.E8.BD.AF.E4.BB.B6xxx.E5.AE.89.E8.A3.85.E5. ...

  10. java获取Mp3播放时长

    最近有一个用java获取mp3播放时长的需求,有两种,一种本地文件,一种网络文件,其中获取网络mp3播放时间的方法找了挺久终于找到个能用的了. 第一种很简单,下载个jar包  jaudiotagger ...