Given a collection of intervals, merge all overlapping intervals.For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18].在LeetCode“...
分类:
其他好文 时间:
2014-08-19 10:50:54
阅读次数:
247
Given a collection of numbers, return all possible subclasses. 1 public class Solution { 2 public List> permute(int[] num) { 3 ArrayList...
分类:
其他好文 时间:
2014-08-19 09:22:03
阅读次数:
198
Comparator位于java.util包下public interface Comparator强行对某个对象 collection 进行整体排序 的比较函数。可以将 Comparator 传递给 sort 方法(如 Collections.sort 或 Arrays.sort),从而允许在排序...
分类:
编程语言 时间:
2014-08-18 20:16:22
阅读次数:
192
映射
import scala.collection.mutable
object HelloWorld {
def main(args: Array[String]) {
val scores = Map("Alice" -> 10, "Bob" -> 33) //构造一个不可变的Map[String,Int]
val scores2 = scala.collection....
分类:
其他好文 时间:
2014-08-18 16:24:32
阅读次数:
237
读取db.collection.find()db.users.find( { age: {$gt: 18}}, {name: 1, address: 1}).limit(5).sort({age:1})users是collection名字,从users中查找;age是query crit...
分类:
数据库 时间:
2014-08-18 16:14:42
阅读次数:
238
今天跟朋友讨论一个小的知识点,发现很多人不知道collection接口中定义的add方法是有返回值的,大家都是工作很多年的Java从业人员了,对公用接口的不熟悉会让自己在细节上吃亏的。这让我想到了刚入行的时候的一个小面试,另外一个项目的项目经理神秘兮兮的问,jdbc调用sql执行完成之后,返回什么值? 返回什么值?这个问题确实难到我了,但是联想一下,一般在数据库当中执行到最后一步的时候,尤其...
分类:
编程语言 时间:
2014-08-18 14:30:22
阅读次数:
196
今天来总结总结Java集合类。集合类又叫容器类,它封装了很多我们学过的数据结构,这些现成的集合类,实现了各种操作,使用起来非常方便,今天的总结也是以代码为主。
集合大致分为Set、List、Map三种体系。但实际上Java集合类主要由两个接口派生而出,Collection接口和Map接口。
Collection接口的子接口:
1.Set,无序,元素不可重复
2.Queue 队列
3....
分类:
编程语言 时间:
2014-08-18 12:35:54
阅读次数:
217
Java垃圾回收机制 说到垃圾回收(Garbage Collection,GC),很多人就会自然而然地把它和Java联系起来。在Java中,程序员不需要去关心内存动态分配和垃圾回收的问题,这一切都交给了JVM来处理。顾名思义,垃圾回收就是释放垃圾占用的空间,那么在Java中,什么样的对象会被认定为....
分类:
编程语言 时间:
2014-08-18 00:12:53
阅读次数:
278
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T....
分类:
其他好文 时间:
2014-08-17 17:03:22
阅读次数:
184
Statements: This blog was written by me, but most of content is quoted from book【Data Structure with Java Hubbard】
【Description】
we have seen important examples of functions that are more n...
分类:
其他好文 时间:
2014-08-17 01:09:11
阅读次数:
186