env.fromElements(1,2,3)// returns the squared i.map(i->i*i).print();
如下例子是无法推断出Collector的类型的,所以需要声明类型:
DataSet<Integer>input=env.fromElements(1,2,3);// collector type must be declaredinput.flatMap((Integernumber,Collector<String>out)->{StringBuilderbuilder=newStringBuilder();for(inti=0;i<number;i++){builder.append("a");out.collect(builder.toString());}})// returns (on separate lines) "a", "a", "aa", "a", "aa", "aaa".print();
如下是可以根据DataSet推断出类型:
DataSet<Integer>input=env.fromElements(1,2,3);// collector type must not be declared, it is inferred from the type of the datasetDataSet<String>manyALetters=input.flatMap((number,out)->{StringBuilderbuilder=newStringBuilder();for(inti=0;i<number;i++){builder.append("a");out.collect(builder.toString());}});
如下代码展示了一个使用lambda表达式的wordcount程序:
DataSet<String>input=env.fromElements("Please count","the words","but not this");// filter out strings that contain "not"input.filter(line->!line.contains("not"))// split each line by space.map(line->line.split(" "))// emit a pair for each array element.flatMap((String[]wordArray,Collector<Tuple2<String,Integer>>out)->Arrays.stream(wordArray).forEach(t->out.collect(newTuple2<>(t,1))))// group and sum up.groupBy(0).sum(1)// print.print();
如下是一些Java8使用的限制约束等问题,具体参考文档!
Compiler Limitations
Currently, Flink only supports jobs containing Lambda Expressions completely if they are compiled with the Eclipse JDT compiler contained in Eclipse Luna 4.4.2 (and above).
Only the Eclipse JDT compiler preserves the generic type information necessary to use the entire Lambda Expressions feature type-safely. Other compilers such as the OpenJDK’s and Oracle JDK’s javac throw away all generic parameters related to Lambda Expressions. This means that types such as Tuple2 or Collector declared as a Lambda function input or output parameter will be pruned to Tuple2 or Collector in the compiled .class files, which is too little information for the Flink Compiler.
How to compile a Flink job that contains Lambda Expressions with the JDT compiler will be covered in the next section.
However, it is possible to implement functions such as map() or filter() with Lambda Expressions in Java 8 compilers other than the Eclipse JDT compiler as long as the function has no Collectors or Iterables and only if the function handles unparameterized types such as Integer, Long, String, MyOwnClass (types without Generics!).
Compile Flink jobs with the Eclipse JDT compiler and Maven
If you are using the Eclipse IDE, you can run and debug your Flink code within the IDE without any problems after some configuration steps. The Eclipse IDE by default compiles its Java sources with the Eclipse JDT compiler. The next section describes how to configure the Eclipse IDE.
If you are using a different IDE such as IntelliJ IDEA or you want to package your Jar-File with Maven to run your job on a cluster, you need to modify your project’s pom.xml file and build your program with Maven. The quickstart contains preconfigured Maven projects which can be used for new projects or as a reference. Uncomment the mentioned lines in your generated quickstart pom.xml file if you want to use Java 8 with Lambda Expressions.
Alternatively, you can manually insert the following lines to your Maven pom.xml file. Maven will then use the Eclipse JDT compiler for compilation.
If you are using Eclipse for development, the m2e plugin might complain about the inserted lines above and marks your pom.xml as invalid. If so, insert the following lines to your pom.xml.
First of all, make sure you are running a current version of Eclipse IDE (4.4.2 or later). Also make sure that you have a Java 8 Runtime Environment (JRE) installed in Eclipse IDE (Window -> Preferences -> Java -> Installed JREs).
Create/Import your Eclipse project.
If you are using Maven, you also need to change the Java version in your pom.xml for the maven-compiler-plugin. Otherwise right click the JRE System Library section of your project and open the Properties window in order to switch to a Java 8 JRE (or above) that supports Lambda Expressions.
The Eclipse JDT compiler needs a special compiler flag in order to store type information in .class files. Open the JDT configuration file at {project directoy}/.settings/org.eclipse.jdt.core.prefs with your favorite text editor and add the following line:
POJ-1273-Drainage Ditches
http://poj.org/problem?id=1273
基本的最大流,按LRJ的白书写的
#include<iostream>
#include<cstring>
#include<queue>
using namespace std;
#define INF 0x7fffffff
int ma
开启列模式: Alt+C 鼠标选择 OR Alt+鼠标左键拖动
列模式替换或复制内容(多行):
右键-->格式-->填充所选内容-->选择相应操作
OR
Ctrl+Shift+V(复制多行数据,必须行数一致)
-------------------------------------------------------
About Health Monitor
Beginning with Release 11g, Oracle Database includes a framework called Health Monitor for running diagnostic checks on the database.
About Health Monitor Checks
Health M
实现功能的代码:
# include <stdio.h>
# include <malloc.h>
struct Student
{
int age;
float score;
char name[100];
};
int main(void)
{
int len;
struct Student * pArr;
int i,
http://wiki.sdn.sap.com/wiki/display/BOBJ/Troubleshooting+Crystal+Reports+off+BW#TroubleshootingCrystalReportsoffBW-TracingBOE
Quite useful, especially this part:
SAP BW connectivity
For t