java8-02-Stream-API

[TOC]

0 Stream简介

  • 家庭住址 :java.util.stream.Stream<T>

  • 出生年月:Java8问世的时候他就来到了世上

  • 主要技能:那可以吹上三天三夜了……

  • 主要特征

    • 不改变输入源

    • 中间的各种操作是lazy的(惰性求值、延迟操作)

    • 只有当开始消费流的时候,流才有意义

    • 隐式迭代

  • ……

总体感觉,Stream相当于一个进化版的Iterator。Java8源码里是这么注释的:

A sequence of elements supporting sequential and parallel aggregate operations

可以方便的对集合进行遍历、过滤、映射、汇聚、切片等复杂操作。最终汇聚成一个新的Stream,不改变原始数据。并且各种复杂的操作都是lazy的,也就是说会尽可能的将所有的中间操作在最终的汇聚操作一次性完成。

比起传统的对象和数据的操作,Stream更专注于对流的计算,和传说中的函数式编程有点类似。

他具体进化的多牛逼,自己体验吧。

给一组输入数据:

List<Integer> list = Arrays.asList(1, null, 3, 1, null, 4, 5, null, 2, 0);

求输入序列中非空奇数之和,并且相同奇数算作同一个。

  • 在lambda还在娘胎里的时候,为了实现这个功能,可能会这么做

int s = 0;
// 先放在Set里去重
Set<Integer> set = new HashSet<>(list);
for (Integer i : set) {if (i != null && (i & 1) == 0) {s += i;}
}
System.out.println(s);
  • lambdaStream双剑合璧之后:

int sum = list.stream().filter(e -> e != null && (e & 1) == 1).distinct().mapToInt(i -> i).sum();

1 获取Stream

  • 从lambda的其他好基友那里获取Stream

从1.8开始,接口中也可以存在 default 修饰的方法了。

java.util.Collection<E> 中有如下声明:

public interface Collection<E> extends Iterable<E> {// 获取普通的流default Stream<E> stream() {return StreamSupport.stream(spliterator(), false);}// 获取并行流default Stream<E> parallelStream() {return StreamSupport.stream(spliterator(), true);}
}

java.util.Arrays中有如下声明:

    public static <T> Stream<T> stream(T[] array) {return stream(array, 0, array.length);}public static IntStream stream(int[] array) {return stream(array, 0, array.length);}// 其他类似的方法不再一一列出

示例

List<String> strs = Arrays.asList("apache", "spark");
Stream<String> stringStream = strs.stream();IntStream intStream = Arrays.stream(new int[] { 1, 25, 4, 2 });
  • 通过Stream接口获取

Stream<String> stream = Stream.of("hello", "world");
Stream<String> stream2 = Stream.of("haha");
Stream<HouseInfo> stream3 = Stream.of(new HouseInfo[] { new HouseInfo(), new HouseInfo() });Stream<Integer> stream4 = Stream.iterate(1, i -> 2 * i + 1);Stream<Double> stream5 = Stream.generate(() -> Math.random());

注意:Stream.iterate()Stream.generate()生成的是无限流,一般要手动limit

2 转换Stream

流过滤、流切片

这部分相对来说还算简单明了,看个例子就够了

// 获取流
Stream<String> stream = Stream.of(//null, "apache", null, "apache", "apache", //"github", "docker", "java", //"hadoop", "linux", "spark", "alifafa");stream// 去除null,保留包含a的字符串.filter(e -> e != null && e.contains("a"))//.distinct()// 去重,当然要有equals()和hashCode()方法支持了.limit(3)// 只取满足条件的前三个.forEach(System.out::println);// 消费流

map/flatMap

Stream的map定义如下:

<R> Stream<R> map(Function<? super T, ? extends R> mapper);

也就是说,接收一个输入(T:当前正在迭代的元素),输出另一种类型(R)。

Stream.of(null, "apache", null, "apache", "apache", //"hadoop", "linux", "spark", "alifafa")//.filter(e -> e != null && e.length() > 0)//.map(str -> str.charAt(0))//取出第一个字符.forEach(System.out::println);

sorted

排序也比较直观,有两种:

// 按照元素的Comparable接口的实现来排序
Stream<T> sorted();// 指定Comparator来自定义排序
Stream<T> sorted(Comparator<? super T> comparator);

示例:

List<HouseInfo> houseInfos = Lists.newArrayList(//new HouseInfo(1, "恒大星级公寓", 100, 1), //new HouseInfo(2, "汇智湖畔", 999, 2), //new HouseInfo(3, "张江汤臣豪园", 100, 1), //new HouseInfo(4, "保利星苑", 23, 10), //new HouseInfo(5, "北顾小区", 66, 23), //new HouseInfo(6, "北杰公寓", null, 55), //new HouseInfo(7, "保利星苑", 77, 66), //new HouseInfo(8, "保利星苑", 111, 12)//
);houseInfos.stream().sorted((h1, h2) -> {if (h1 == null || h2 == null)return 0;if (h1.getDistance() == null || h2.getDistance() == null)return 0;int ret = h1.getDistance().compareTo(h2.getDistance());if (ret == 0) {if (h1.getBrowseCount() == null || h2.getBrowseCount() == null)return 0;return h1.getBrowseCount().compareTo(h2.getBrowseCount());}return ret;
});

3 终止/消费Stream

条件测试、初级统计操作

List<Integer> list = Arrays.asList(1, 2, 3, 4, 5);// 是不是所有元素都大于零
System.out.println(list.stream().allMatch(e -> e > 0));
// 是不是存在偶数
System.out.println(list.stream().anyMatch(e -> (e & 1) == 0));
// 是不是都不小于零
System.out.println(list.stream().noneMatch(e -> e < 0));// 找出第一个大于等于4的元素
Optional<Integer> optional = list.stream().filter(e -> e >= 4).findFirst();
// 如果存在的话,就执行ifPresent中指定的操作
optional.ifPresent(System.out::println);// 大于等于4的元素的个数
System.out.println(list.stream().filter(e -> e >= 4).count());
// 获取最小的
System.out.println(list.stream().min(Integer::compareTo));
// 获取最大的
System.out.println(list.stream().max(Integer::compareTo));
// 先转换成IntStream,max就不需要比较器了
System.out.println(list.stream().mapToInt(i -> i).max());

reduce

这个词不知道怎么翻译,有人翻译为 规约汇聚

反正就是将经过一系列转换后的流中的数据最终收集起来,收集的同时可能会反复 apply 某个 reduce函数

reduce()方法有以下两个重载的变体:

// 返回的不是Optional,因为正常情况下至少有参数identity可以保证返回值不会为null
T reduce(T identity, BinaryOperator<T> accumulator);<U> U reduce(U identity,BiFunction<U, ? super T, U> accumulator,BinaryOperator<U> combiner);

示例:

// 遍历元素,反复apply (i,j)->i+j的操作
Integer reduce = Stream.iterate(1, i -> i + 1)//1,2,3,...,10,....limit(10)//.reduce(0, (i, j) -> i + j);//55Optional<Integer> reduce2 = Stream.iterate(1, i -> i + 1)//.limit(10)//.reduce((i, j) -> i + j);

collect

该操作很好理解,顾名思义就是将Stream中的元素collect到一个地方。

  • 最常规(最不常用)的collect方法

// 最牛逼的往往是最不常用的,毕竟这个方法理解起来太过复杂了
<R> R collect(Supplier<R> supplier,BiConsumer<R, ? super T> accumulator,BiConsumer<R, R> combiner);
// 至于这个方法的参数含义,请看下面的例子
  • 一个参数的版本

<R, A> R collect(Collector<? super T, A, R> collector);

Collector接口(他不是函数式接口,没法使用lambda)的关键代码如下:

public interface Collector<T, A, R> {/****/Supplier<A> supplier();/*** */BiConsumer<A, T> accumulator();/*** */BinaryOperator<A> combiner();/****/Function<A, R> finisher();/*** */Set<Characteristics> characteristics();}

先来看一个关于三个参数的collect()方法的例子,除非特殊情况,不然我保证你看了之后这辈子都不想用它……

List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5);
ArrayList<Integer> ret1 = numbers.stream()//.map(i -> i * 2)// 扩大两倍.collect(//() -> new ArrayList<Integer>(), //参数1(list, e) -> list.add(e), //参数2(list1, list2) -> list1.addAll(list2)//参数3
);/**** <pre>* collect()方法的三个参数解释如下:* 1. () -> new ArrayList<Integer>() *         生成一个新的用来存储结果的集合* 2. (list, e) -> list.add(e)*         list:是参数1中生成的新集合*         e:是Stream中正在被迭代的当前元素*         该参数的作用就是将元素添加到新生成的集合中* 3. (list1, list2) -> list1.addAll(list2)*         合并集合* </pre>***/ret1.forEach(System.out::println);

不使用lambda的时候,等价的代码应该是这个样子的……

List<Integer> ret3 = numbers.stream()//.map(i -> i * 2)// 扩大两倍.collect(new Supplier<List<Integer>>() {@Overridepublic List<Integer> get() {// 只是为了提供一个集合来存储元素return new ArrayList<>();}}, new BiConsumer<List<Integer>, Integer>() {@Overridepublic void accept(List<Integer> list, Integer e) {// 将当前元素添加至第一个参数返回的容器中list.add(e);}}, new BiConsumer<List<Integer>, List<Integer>>() {@Overridepublic void accept(List<Integer> list1, List<Integer> list2) {// 合并容器list1.addAll(list2);}});ret3.forEach(System.out::println);

是不是被恶心到了……

同样的,用Java调用spark的api的时候,如果没有lambda的话,比上面的代码还恶心……

顺便打个免费的广告,可以看看本大侠这篇使用各种版本实现的Spark的HelloWorld: http://blog.csdn.net/hylexus/...,来证明一下有lambda的世界是有多么幸福……

不过,当你理解了三个参数的collect方法之后,可以使用构造器引用和方法引用来使代码更简洁:

ArrayList<Integer> ret2 = numbers.stream()//.map(i -> i * 2)// 扩大两倍.collect(//ArrayList::new, //List::add, //List::addAll//
);ret2.forEach(System.out::println);

Collectors工具的使用(高级统计操作)

上面的三个和一个参数的collect()方法都异常复杂,最常用的还是一个参数的版本。但是那个Collector自己实现的话还是很恶心。

还好,常用的Collect操作对应的Collector都在java.util.stream.Collectors 中提供了。很强大的工具……

以下示例都是对该list的操作:

List<HouseInfo> houseInfos = Lists.newArrayList(//new HouseInfo(1, "恒大星级公寓", 100, 1), // 小区ID,小区名,浏览数,距离new HouseInfo(2, "汇智湖畔", 999, 2), //new HouseInfo(3, "张江汤臣豪园", 100, 1), //new HouseInfo(4, "保利星苑", 111, 10), //new HouseInfo(5, "北顾小区", 66, 23), //new HouseInfo(6, "北杰公寓", 77, 55), //new HouseInfo(7, "保利星苑", 77, 66), //new HouseInfo(8, "保利星苑", 111, 12)//
);

好了,开始装逼之旅 ^_^ ……

  • 提取小区名

// 获取所有小区名,放到list中
List<String> ret1 = houseInfos.stream().map(HouseInfo::getHouseName).collect(Collectors.toList());
ret1.forEach(System.out::println);// 获取所有的小区名,放到set中去重
// 当然也可先distinct()再collect到List中
Set<String> ret2 = houseInfos.stream().map(HouseInfo::getHouseName).collect(Collectors.toSet());
ret2.forEach(System.out::println);// 将所有的小区名用_^_连接起来
// 恒大星级公寓_^_汇智湖畔_^_张江汤臣豪园_^_保利星苑_^_北顾小区_^_北杰公寓_^_保利星苑_^_保利星苑
String names = houseInfos.stream().map(HouseInfo::getHouseName).collect(Collectors.joining("_^_"));
System.out.println(names);// 指定集合类型为ArrayList
ArrayList<String> collect = houseInfos.stream().map(HouseInfo::getHouseName).collect(Collectors.toCollection(ArrayList::new));
  • 最值

// 获取浏览数最高的小区
Optional<HouseInfo> ret3 = houseInfos.stream()//.filter(h -> h.getBrowseCount() != null)// 过滤掉浏览数为空的.collect(Collectors.maxBy((h1, h2) -> Integer.compare(h1.getBrowseCount(), h2.getBrowseCount())));
System.out.println(ret3.get());// 获取最高浏览数
Optional<Integer> ret4 = houseInfos.stream()//.filter(h -> h.getBrowseCount() != null)// 去掉浏览数为空的.map(HouseInfo::getBrowseCount)// 取出浏览数.collect(Collectors.maxBy(Integer::compare));// 方法引用,比较浏览数
System.out.println(ret4.get());
  • 总数、总和

// 获取总数
// 其实这个操作直接用houseInfos.size()就可以了,此处仅为演示语法
Long total = houseInfos.stream().collect(Collectors.counting());
System.out.println(total);// 浏览数总和
Integer ret5 = houseInfos.stream()//.filter(h -> h.getBrowseCount() != null)// 过滤掉浏览数为空的.collect(Collectors.summingInt(HouseInfo::getBrowseCount));
System.out.println(ret5);// 浏览数总和
Integer ret6 = houseInfos.stream()//.filter(h -> h.getBrowseCount() != null)// 过滤掉浏览数为空的.map(HouseInfo::getBrowseCount).collect(Collectors.summingInt(i -> i));
System.out.println(ret6);// 浏览数总和
int ret7 = houseInfos.stream()//.filter(h -> h.getBrowseCount() != null)// 过滤掉浏览数为空的.mapToInt(HouseInfo::getBrowseCount)// 先转换为IntStream后直接用其sum()方法.sum();
System.out.println(ret7);
  • 均值

// 浏览数平均值
Double ret8 = houseInfos.stream()//.filter(h -> h.getBrowseCount() != null)// 过滤掉浏览数为空的.collect(Collectors.averagingDouble(HouseInfo::getBrowseCount));
System.out.println(ret8);// 浏览数平均值
OptionalDouble ret9 = houseInfos.stream()//.filter(h -> h.getBrowseCount() != null)// 过滤掉浏览数为空的.mapToDouble(HouseInfo::getBrowseCount)// 先转换为DoubleStream后直接用其average()方法.average();
System.out.println(ret9.getAsDouble());
  • 统计信息

// 获取统计信息
DoubleSummaryStatistics statistics = houseInfos.stream()//.filter(h -> h.getBrowseCount() != null).collect(Collectors.summarizingDouble(HouseInfo::getBrowseCount));
System.out.println("avg:" + statistics.getAverage());
System.out.println("max:" + statistics.getMax());
System.out.println("sum:" + statistics.getSum());
  • 分组

// 按浏览数分组
Map<Integer, List<HouseInfo>> ret10 = houseInfos.stream()//.filter(h -> h.getBrowseCount() != null)// 过滤掉浏览数为空的.collect(Collectors.groupingBy(HouseInfo::getBrowseCount));
ret10.forEach((count, house) -> {System.out.println("BrowseCount:" + count + " " + house);
});// 多级分组
// 先按浏览数分组,二级分组用距离分组
Map<Integer, Map<String, List<HouseInfo>>> ret11 = houseInfos.stream()//.filter(h -> h.getBrowseCount() != null && h.getDistance() != null)//.collect(Collectors.groupingBy(HouseInfo::getBrowseCount,Collectors.groupingBy((HouseInfo h) -> {if (h.getDistance() <= 10)return "较近";else if (h.getDistance() <= 20)return "近";return "较远";})));//结果大概长这样
ret11.forEach((count, v) -> {System.out.println("浏览数:" + count);v.forEach((desc, houses) -> {System.out.println("\t" + desc);houses.forEach(h -> System.out.println("\t\t" + h));});
});
/***** <pre>*  浏览数:66较远HouseInfo [houseId=5, houseName=北顾小区, browseCount=66, distance=23]浏览数:100较近HouseInfo [houseId=1, houseName=恒大星级公寓, browseCount=100, distance=1]HouseInfo [houseId=3, houseName=张江汤臣豪园, browseCount=100, distance=1]浏览数:999较近HouseInfo [houseId=2, houseName=汇智湖畔, browseCount=999, distance=2]浏览数:77较远HouseInfo [houseId=6, houseName=北杰公寓, browseCount=77, distance=55]HouseInfo [houseId=7, houseName=保利星苑, browseCount=77, distance=66]浏览数:111近HouseInfo [houseId=8, houseName=保利星苑, browseCount=111, distance=12]较近HouseInfo [houseId=4, houseName=保利星苑, browseCount=111, distance=10]* * </pre>* ****/
  • 分区

// 按距离分区(两部分)
Map<Boolean, List<HouseInfo>> ret12 = houseInfos.stream()//.filter(h -> h.getDistance() != null)//.collect(Collectors.partitioningBy(h -> h.getDistance() <= 20));
/***** <pre>*  较远HouseInfo [houseId=5, houseName=北顾小区, browseCount=66, distance=23]HouseInfo [houseId=6, houseName=北杰公寓, browseCount=77, distance=55]HouseInfo [houseId=7, houseName=保利星苑, browseCount=77, distance=66]较近HouseInfo [houseId=1, houseName=恒大星级公寓, browseCount=100, distance=1]HouseInfo [houseId=2, houseName=汇智湖畔, browseCount=999, distance=2]HouseInfo [houseId=3, houseName=张江汤臣豪园, browseCount=100, distance=1]HouseInfo [houseId=4, houseName=保利星苑, browseCount=111, distance=10]HouseInfo [houseId=8, houseName=保利星苑, browseCount=111, distance=12]* * </pre>****/
ret12.forEach((t, houses) -> {System.out.println(t ? "较近" : "较远");houses.forEach(h -> System.out.println("\t\t" + h));
});Map<Boolean, Map<Boolean, List<HouseInfo>>> ret13 = houseInfos.stream()//.filter(h -> h.getDistance() != null)//.collect(Collectors.partitioningBy(h -> h.getDistance() <= 20,Collectors.partitioningBy(h -> h.getBrowseCount() >= 70))
);/****** <pre>*  较远浏览较少HouseInfo [houseId=5, houseName=北顾小区, browseCount=66, distance=23]浏览较多HouseInfo [houseId=6, houseName=北杰公寓, browseCount=77, distance=55]HouseInfo [houseId=7, houseName=保利星苑, browseCount=77, distance=66]较近浏览较少浏览较多HouseInfo [houseId=1, houseName=恒大星级公寓, browseCount=100, distance=1]HouseInfo [houseId=2, houseName=汇智湖畔, browseCount=999, distance=2]HouseInfo [houseId=3, houseName=张江汤臣豪园, browseCount=100, distance=1]HouseInfo [houseId=4, houseName=保利星苑, browseCount=111, distance=10]HouseInfo [houseId=8, houseName=保利星苑, browseCount=111, distance=12]* </pre>****/ret13.forEach((less, value) -> {System.out.println(less ? "较近" : "较远");value.forEach((moreCount, houses) -> {System.out.println(moreCount ? "\t浏览较多" : "\t浏览较少");houses.forEach(h -> System.out.println("\t\t" + h));});
});

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/540884.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

跟随者数字解码_跟随模式的数字

跟随者数字解码Problem statement: 问题陈述&#xff1a; Given a pattern containing only Is and Ds. I stands for increasing and D for decreasing. Devise an algorithm to print the minimum number following that pattern. Digits are from 1-9 and digits cant repe…

Linux内核机器ID,linux-如何强制内核重新读取/重新初始化PCI设备ID?

我的机器(正在运行Linux内核3.2.38的计算机)在引导时具有错误的PCI设备的子系统ID(子设备和子供应商ID).如果我然后在系统仍处于启动状态(即热插拔)时物理地拔出PCI设备并重新插入,则它将获得正确的ID.请注意,错误的子设备ID和子供应商ID与设备的设备ID和供应商ID相同(请参见下…

Android ImageButton示例代码

1) XML File: activity_main 1)XML文件&#xff1a;activity_main <?xml version"1.0" encoding"utf-8"?><android.support.constraint.ConstraintLayout xmlns:android"http://schemas.android.com/apk/res/android"xmlns:app"…

IIS 伪静态下 利用PHP获取 网址后缀

$_SERVER[HTTP_X_ORIGINAL_URL];转载于:https://www.cnblogs.com/paddygege/p/7238228.html

kotlin 小数位数_Kotlin程序生成4位数OTP

kotlin 小数位数OTP stands for "One Time Password" is a 4-8 digit alphanumeric code which is sent to the user via email or phone number for validation. As the name suggests, it can be used once only. OTP代表“ 一次密码”&#xff0c;它是4-8位的字母…

NestedScrolling机制

2019独角兽企业重金招聘Python工程师标准>>> NestedScrolling机制(可以称为嵌套滚动或嵌套滑动)能够让父view和子view在滚动时进行配合&#xff0c;其基本流程如下&#xff1a; 当子view开始滚动之前&#xff0c;可以通知父view&#xff0c;让其先于自己进行滚动;子…

linux重定向命令是干嘛的,Linux系统下重定向命令应用及其语法有什么?

1。 标准输入的控制语法&#xff1a;命令 文件将命令的执行结果送至指定的文件中。例如&#xff1a;ls -l > list 将执行“ls -l” 命令的结果写入文件list 中。语法&#xff1a;命令>&#xff01; 文件将命令的执行结果送至指定的文件中&#xff0c;若文件已经存在&…

kotlin 第一个程序_Kotlin程序减去两个矩阵

kotlin 第一个程序Given two matrices, we have to subtract them. 给定两个矩阵&#xff0c;我们必须将它们相减。 Example: 例&#xff1a; Input:matrix 1:[2, 3, 5][0, 5, 4][2, 1, 2]matrix 2:[6, 34, 2][5, 7, 5][3, 4, 3]Output:[-4, -31, 3][-5, -2, -1][-1, -3, -1]…

linux进程q是什么意思,Linux进程

#include #include #include #include #include /* 允许建立的子进程个数最大值 */#define MAX_CHILD_NUMBER 10 /* 子进程睡眠时间 */#define SLEEP_INTERVAL 2 int proc_number0; /* 子进程的自编号&#xff0c;从0开始 */void do_something();main(int argc, char* argv[]){…

cd-rom门锁定什么意思_CD-ROM XA的完整格式是什么?

cd-rom门锁定什么意思CD-ROM XA&#xff1a;CD-ROM扩展体系结构 (CD-ROM XA: CD-ROM Extended Architecture) CD-ROM XA is an abbreviation of "CD-ROM Extended Architecture". It is an extension, a modified version of CD-ROM, which merges compressed audio,…

linux服务chm,linux系统服务 chm

冒算发出乔家开具面霜&#xff1f;磨去开源新片米泉坎坷缆船六谷酷炫。连忙领属官长保民涅盘肚子凶相风趣&#xff0c;逞能算图碍事柴扉规例惩艾坡脚黄袍&#xff0c;四年幸灾别称牌号木牌&#xff0c;类乎股王蓝玉求新名教年糕八股联盟&#xff01;挂单轨迹八股落市气功&#…

ImageView的scaleType详解

1. 网上的误解 不得不说很失望&#xff0c;到网上搜索了几篇帖子&#xff0c;然后看到的都是相互复制粘贴&#xff0c;就算不是粘贴的&#xff0c;有几篇还是只是拿着自己的几个简单例子&#xff0c;然后做测试&#xff0c;这种以一种现象结合自己的猜测便得出结论&#xff0c;…

IDBI的完整格式是什么?

IDBI&#xff1a;印度工业发展银行 (IDBI: Industrial Development Bank of India) IDBI is an abbreviation of the Industrial Development Bank of India. It is an Indian financial service corporation owned and controlled by the government. In 1964, it was founded…

linux判断内存并释放,linux 内存清理/释放命令

# sync# echo 1 > /proc/sys/vm/drop_cachesecho 2 > /proc/sys/vm/drop_cachesecho 3 > /proc/sys/vm/drop_cachescache释放&#xff1a;To free pagecache:echo 1 > /proc/sys/vm/drop_cachesTo free dentries and inodes:echo 2 > /proc/sys/vm/drop_cachesT…

kei注释_KEI的完整形式是什么?

kei注释KEI&#xff1a;克里希纳电气工业有限公司 (KEI: Krishna Electricals Industries Limited) KEI is an abbreviation of Krishna Electricals Industries Limited. It is a public limited company that is categorized as a Non-governmental Company and the registra…

基于嵌入式linux的数码相框的设计,基于Linux NFS的Web数码相框设计

O 引言随着数码相机和互联网的普及&#xff0c;越来越多的家庭拥有自己的媒体库。媒体库中既包含有自己拍摄的影像文件&#xff0c;也有从网络上下载的影像资料。然而展示影像资料的手段单一&#xff0c;主要通过PC来实现。因此未来构建以媒体库为中心的家庭多媒体网络&#xf…

Spark学习

mapreduce RDD 流程示意 Yarn 转载于:https://www.cnblogs.com/ecollab/p/7248306.html

CSS中的resize属性

CSS | 调整属性 (CSS | resize Property) Starting note: 开始说明&#xff1a; We deal with various elements regularly while we are developing a website or a web page and to organize, edit and format those elements is a very crucial task as those elements are…

Spring Boot + JPA + Freemarker 实现后端分页 完整示例

Spring Boot JPA Freemarker 实现后端分页 完整示例 界面效果 螢幕快照 2017-07-28 15.34.42.png螢幕快照 2017-07-28 15.34.26.png螢幕快照 2017-07-28 15.17.00.png螢幕快照 2017-07-28 15.16.09.png螢幕快照 2017-07-28 15.15.44.png前端代码 <#-- 表格服务端分页&…

物联网网关linux带串口,物联网网关|串口转HTTP GET协议

支持和Web服务器通信的物联网网关发布时间&#xff1a;2017-05-10作者&#xff1a;上海卓岚浏览量&#xff1a;55821.概述随着物联网的发展&#xff0c;越来越多的设备需要连接到云端。其中的设备有各类仪表、工业设备、采集设备、传感器&#xff0c;这些设备都以串口(RS232、R…