Flink -- Java Generics Programming】的更多相关文章

Flink uses a lot of generics programming, which is an executor Framework with cluster of executor having a lot of thread for task by RPC communication(Actor System). The data and the process of data are defined by user. Event-Driven == Callback funct…
The beginning of this chapter introduced the idea of writing code that can be applied as generally as possible. To do this, we need ways to loosen the constraints on the types that our code works with, without losing the benefits of static type check…
​Ordinary classes and methods work with specific types: either primitives or class types. If you are writing code that might be used across more types, this rigidity can be overconstraining. One way that object-oriented languages allow generalization…
关于Flink相关的概念性东西就不说了,网上都有,官网也很详尽.本文主要记录一下Java使用Flink的简单例子. 首先,去官网下载Flink的zip包(链接就不提供了,你已经是个成熟的程序员了,该有一定的搜索能力了),解压后放到你想放的地方. 进入主目录后,是这样子的   image.png 你可以简单的看下其目录结构,然后就回到你喜欢的IDE创建一个工程吧. 使用IDEA创建一个maven项目,然后加入相应的依赖即可.也可以按照Flink官网的方式去创建一个maven工程,然后导入你喜欢的I…
Example Program The following program is a complete, working example of streaming window word count application, that counts the words coming from a web socket in 5 second windows. public class WindowWordCount { public static void main(String[] args)…
 https://ci.apache.org/projects/flink/flink-docs-release-0.10/apis/programming_guide.html   Example Program 编程的风格和spark很类似, ExecutionEnvironment  -- SparkContext DataSet – RDD Transformations 这里用Java的接口,所以传入function需要用FlatMapFunction类对象   public clas…
目录 Chapter 8. Refactoring, testing, and debugging Chapter 9. Default methods Chapter 10. Using Optional as a better alternative to null Chapter 11. CompletableFuture: composable asynchronous programming Chapter 12. New Date and Time API(未完) Chapter 8…
2.4 The Get and Put Principle Get and Put Principle: 用于取对象的泛型集合,声明为 <? extends T> 用于存对象的泛型集合,声明为 <? super T> 如果同时存取,那么还是老老实实的用< T>吧 注意: void put(List<? extends Number> nums){ nums.add(?) } 上面代码中'?'处只能放入null值,因为你并不能确定nums具体是什么类型的Lis…
2.3 Wildcards with super 这里就直接拿书上的例子好了,这是Collections里面的一个方法: public static <T> void copy(List<? super T> dst,List<? extends T> src){ for(int i = 0; i < src.size(); i++){ dst.set(i,src.get(i)); } } 其中<? super T> 表示T以以及T的父类,java的泛…
2.2 Wildcards with extends 前面介绍过List<Integer>不是List<Number>的子类,即前者不能替换后者, java使用? extends [classname]语法,即List<Integer> 可以替换 List<? extends Number>. 看两段代码: package java_generics_collections.chap2; import org.junit.Test; import java.…