- 博客(9)
- 资源 (3)
- 收藏
- 关注
转载 Java8 Stream 教程
1. Stream初体验 我们先来看看Java里面是怎么定义Stream的: A sequence of elements supporting sequential and parallel aggregate operations. 我们来解读一下上面的那句话: Stream是元素的集合,这点让Stream看起来用些类似Iterator;可以支持顺序和并行的对原
2015-02-24 23:46:22 1456
原创 Java8 Stream初体验
如果你能说对下面这个语句的正确输出,那么恭喜你,这篇文章就不用看了~ List nums = Arrays.asList(1,1,null,2,3,4,null,5,6,7,8,9,10); System.out.println("sum is:"+nums.stream().filter(num -> num != null).distinct(). mapToInt(num ->
2015-02-23 21:45:48 3136
转载 深入理解Java8 lambda表达式
本文主要记录自己学习Java8的历程,方便大家一起探讨和自己的备忘。因为本人也是刚刚开始学习Java8,所以文中肯定有错误和理解偏差的地方,希望大家帮忙指出,我会持续修改和优化。本文是该系列的第一篇,主要介绍Java8对屌丝码农最有吸引力的一个特性—lambda表达式。 java8的安装 工欲善其器必先利其器,首先安装JDK8。过程省略,大家应该都可以自己搞定。但是有一点这里强调一下(Wi
2015-02-22 23:12:11 1850
原创 使用lambda表达式操作HashMap
Java8之前,如果想根据map的value值来排序话,比较繁琐参看如何将HashMap,按照value值排序 现在借助于lambda表达式,就方便多了。 Map map=new HashMap<>(); map.put("derek",24 ); map.put("dad", 51); map.put("mom", 46); List> list=new ArrayList
2015-02-22 23:03:14 15017
转载 Java开发者易犯错误Top10
本文总结了Java开发者经常会犯的前十种错误列表。 Top1. 数组转换为数组列表 将数组转换为数组列表,开发者经常会这样做: [java] view plaincopy List list = Arrays.asList(arr); Arrays.asList()将返回一个数组内部是私有静态类的Ar
2015-02-20 12:24:58 1274
原创 【leetcode SQL】Customers Who Never Order
Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL query to find all customers who never order anything. Table: Customers. +----+-------+ | Id | Na
2015-02-01 22:06:54 2773
原创 【leetcode SQL】Employees Earning More Than Their Managers
The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id. +----+-------+--------+-----------+ | Id | Name | Salary |
2015-02-01 21:20:48 3007
原创 【leetcode Java】Majority Element
题目如下 Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the majority
2015-02-01 15:44:17 2719
原创 【leetcode Java】Excel Sheet Column Number
题目如下: Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 可
2015-02-01 00:45:39 4276
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人