Download Java - Fabrizio Montesi

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Reactive programming wikipedia , lookup

Programming language wikipedia , lookup

Abstraction (computer science) wikipedia , lookup

Structured programming wikipedia , lookup

Join-pattern wikipedia , lookup

Functional programming wikipedia , lookup

Falcon (programming language) wikipedia , lookup

Covariance and contravariance (computer science) wikipedia , lookup

Class (computer programming) wikipedia , lookup

Java syntax wikipedia , lookup

Object-oriented programming wikipedia , lookup

Name mangling wikipedia , lookup

C++ wikipedia , lookup

Go (programming language) wikipedia , lookup

Scala (programming language) wikipedia , lookup

C Sharp syntax wikipedia , lookup

Java (programming language) wikipedia , lookup

Java performance wikipedia , lookup

C Sharp (programming language) wikipedia , lookup

Transcript
Concurrent Programming
2: Java, Java, Java
Fabrizio Montesi
<[email protected]>
Java
●
We are going to use Java as programming language.
Java
●
We are going to use Java as programming language.
●
Question: How many Java programs are concurrent?
Java
●
We are going to use Java as programming language.
●
Question: How many Java programs are concurrent?
●
Go to socrative.com and let's find out.
●
Room name: CP2016
Java
●
We are going to freshen up on Java first.
●
And maybe learn something new.
●
Some things I'll use during the course:
●
Generics
●
Anonymous Inner Classes
●
Lambda expressions
Generics
●
Type parameters for code.
●
Meaning: You write code that is “generic” wrt types.
(note: wrt is short for “with respect to”)
●
Or: Your code can work with data of different types.
●
https://docs.oracle.com/javase/tutorial/java/generics/index.html
Anonymous Inner Classes
●
Inner Class: A class defined within a class. It has a name.
●
Anonymous Inner Class: An Inner Class without a name.
●
https://docs.oracle.com/javase/tutorial/java/javaOO/nested.html
Lambda Expressions
●
●
Functions defined within code.
https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpr
essions.html
For the next time
●
●
●
●
Read up the previous links.
Opt: Define a generic class Pair<K,V> that can store pairs of
values of any types.
Opt: Create a List of Pair<String, Integer> with some values.
For each pair containing a string s and an integer n, we say that
s is associated to n.
Opt: For each string (first value of a pair) in the list, print the
sum of all integers associated to that string.