欢迎关注大数据技术架构与案例微信公众号:过往记忆大数据
过往记忆博客公众号iteblog_hadoop
欢迎关注微信公众号:
过往记忆大数据

标签:Java

Guava

Guava学习之SetMultimap

Guava学习之SetMultimap
   [caption id="attachment_751" align="aligncenter" width="536"] Guava学习之SetMultimap[/caption]   SetMultimap及其子类的继承图如上所示。   SetMultimap是一个接口,继承自Multimap接口,同昨天说的ListMultimap接口类似,它也定义了所有继实现自SetMultimap的子类定义了一些共有的方法签名。SetMultimap接口并没有定义自己特有的方法签名,里面所

w397090770   11年前 (2013-09-25) 9058℃ 1评论4喜欢

Guava

Guava学习之Resources

Guava学习之Resources
  Resources提供提供操作classpath路径下所有资源的方法。除非另有说明,否则类中所有方法的参数都不能为null。虽然有些方法的参数是URL类型的,但是这些方法实现通常不是以HTTP完成的;同时这些资源也非classpath路径下的。  下面两个函数都是根据资源的名称得到其绝对路径,从函数里面可以看出,Resources类中的getResource函数

w397090770   11年前 (2013-09-25) 6415℃ 0评论4喜欢

Guava

Guava学习之ArrayListMultimap

Guava学习之ArrayListMultimap
ArrayListMultimap类的继承关系如下图所示:[caption id="attachment_744" align="aligncenter" width="593"] Guava ArrayListMultimap[/caption]  ListMultimap是一个接口,继承自Multimap接口。ListMultimap接口为所有继实现自ListMultimap的子类定义了一些共有的方法签名。ListMultimap接口并没有定义自己特有的方法签名,里面所有的方法都是重写了Multimap接口中的声明

w397090770   11年前 (2013-09-24) 8164℃ 0评论2喜欢

Guava

Guava学习之CharSequenceReader

Guava学习之CharSequenceReader
  CharSequenceReader类是以CharSequence的形式读取字符。CharSequenceReader类继承自Reader类,除了remaining()、hasRemaining()以及checkOpen()函数之后,其他的函数都是重写Reader类中的函数。CharSequenceReader类声明没有用public关键字,所以我们暂时还不能调用这个类CharSequenceReader类有下面三个成员变量[code lang="JAVA"] private CharSequence seq; //存放

w397090770   11年前 (2013-09-23) 2843℃ 1评论2喜欢

Java

Java中>>和>>>移位操作符的区别

Java中>>和>>>移位操作符的区别
  大家都知道>是比较两个对象的大小,那>>和>>>的区别呢?  >>和>>>都是移位操作;对正数的移位操作它们的功能都是一样的,如下:[code lang="JAVA"]15 >> 2 = 315 >>> 2 = 3[/code]其实就是将15除于4,得到的商。转换为二进制可能更直观(为了方便,下面的二进制操作我们都是以八位进行的,

w397090770   11年前 (2013-09-22) 32540℃ 2评论17喜欢

Java

比较安全的两整数平均值算法实现

比较安全的两整数平均值算法实现
  求两个整数的平均值这个问题相信大家都想过,大家肯定会很快的写出以下的算法:[code lang="JAVA"]public static int mean(int a, int b){ return (a + b) / 2;}或者public static int mean(int a, int b){ return (a + b) >> 1;}或者public static int mean(int a, int b){ return (a + b) >>> 1;}[/code]  不错,上面的函数是能够求出a和b的平

w397090770   11年前 (2013-09-18) 5502℃ 5评论3喜欢

Guava

Guava学习之HashBiMap

Guava学习之HashBiMap
  HashBiMap存储的键和值都只能唯一,不存在键与键、值与值相同的情况(详细分析见我博客:Guava学习之BiMap)。HashBiMap类继承了AbstractMap类并实现了BiMap接口,其类继承关系如下图所示:[caption id="attachment_705" align="aligncenter" width="356"] HashBiMap[/caption]  AbstractMap类实现了Map接口定义的一些方法,而BiMap类定义了其子类需要实现的

w397090770   11年前 (2013-09-16) 4258℃ 0评论3喜欢

Guava

Guava学习之Iterators

Guava学习之Iterators
  Iterators类提供了返回Iterator类型的对象或者对Iterator类型对象操作的方法。除了特别的说明,Iterators类中所有的方法都在Iterables类中有相应的基于Iterable方法对应。  性能说明:除非特别说明,所有在这个类中的迭代器都是懒惰的,这意味着在觉得必要的时候,需要提前得到迭代功能。Iterators类可以通过emptyIterator()方法得到

w397090770   11年前 (2013-09-11) 3877℃ 3评论0喜欢

Guava

Guava学习之Lists

Guava学习之Lists
  Lists类主要提供了对List类的子类构造以及操作的静态方法。在Lists类中支持构造ArrayList、LinkedList以及newCopyOnWriteArrayList对象的方法。其中提供了以下构造ArrayList的函数:下面四个构造一个ArrayList对象,但是不显式的给出申请空间的大小:[code lang="JAVA"]   newArrayList()   newArrayList(E... elements)   newArrayList(Iterable<?

w397090770   11年前 (2013-09-10) 19649℃ 2评论8喜欢

Guava

Guava学习之Splitter

Guava学习之Splitter
  Splitter:在Guava官方的解释为:Extracts non-overlapping substrings from an input string, typically by recognizing appearances of a separator sequence. This separator can be specified as a single character, fixed string, regular expression or CharMatcher instance. Or, instead of using a separator at all, a splitter can extract adjacent substrings of a given fixed length. 

w397090770   11年前 (2013-09-09) 6921℃ 1评论0喜欢