SlideShare ist ein Scribd-Unternehmen logo
1 von 44
Downloaden Sie, um offline zu lesen
1
Java Advanced
Features
Trenton Computer Festival
March 15, 2014
Michael P. Redlich
@mpredli
about.me/mpredli/
Sunday, March 16, 14
Who’s Mike?
• BS in CS from
• “Petrochemical Research Organization”
• Ai-Logix, Inc. (now AudioCodes)
• Amateur Computer Group of New Jersey
• Publications
• Presentations
2
Sunday, March 16, 14
Objectives (1)
• Java Beans
• Exception Handling
• Generics
• Java Database Connectivity
• Java Collections Framework
3
Sunday, March 16, 14
Java Beans
4
Sunday, March 16, 14
What are Java Beans?
• A method for developing reusable Java
components
• Also known as POJOs (Plain Old Java Objects)
• Easily store and retrieve information
5
Sunday, March 16, 14
Java Beans (1)
• A Java class is considered a bean when it:
• implements interface Serializable
• defines a default constructor
• defines properly named getter/setter methods
6
Sunday, March 16, 14
Java Beans (2)
• Getter/Setter methods:
• return (get) and assign (set) a bean’s data
members
• Specified naming convention:
•getMember
•setMember
•isValid
7
Sunday, March 16, 14
8
// PersonBean class (partial listing)
public class PersonBean implements Serializable {
private static final long serialVersionUID = 7526472295622776147L;
private String lastName;
private String firstName;
private boolean valid;
public PersonBean() {
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
// getter/setter for firstName
public boolean isValid() {
return valid;
}
}
Sunday, March 16, 14
Exception Handling
9
Sunday, March 16, 14
What is Exception
Handling?
• A more robust method for handling errors
than fastidiously checking for error codes
• error code checking is tedious and can obscure
program logic
10
Sunday, March 16, 14
Exception Handling (1)
• Throw Expression:
• raises the exception
• Try Block:
• contains a throw expression or a method that
throws an exception
11
Sunday, March 16, 14
Exception Handling (2)
• Catch Clause(s):
• handles the exception
• defined immediately after the try block
• Finally Clause:
• always gets called regardless of where exception
is caught
• sets something back to its original state
12
Sunday, March 16, 14
Java Exception Model
(1)
• Checked Exceptions
• enforced by the compiler
• Unchecked Exceptions
• recommended, but not enforced by the
compiler
13
Sunday, March 16, 14
Java Exception Model
(2)
• Exception Specification
• specify what type of exception(s) a method will
throw
• Termination vs. Resumption semantics
14
Sunday, March 16, 14
15
// ExceptionDemo class
public class ExceptionDemo {
public static void main(String[] args) {
try {
initialize();
}
catch(Exception exception) {
exception.printStackTrace();
}
public void initialize() throws Exception {
// contains code that may throw an exception of type Exception
}
}
Sunday, March 16, 14
Generics
16
Sunday, March 16, 14
What are Generics?
• A mechanism to ensure type safety in Java
collections
• introduced in Java 5
• Similar concept to C++ Template
mechanism
17
Sunday, March 16, 14
Generics (1)
• Prototype:
• visibilityModifier class |
interface name<Type> {}
18
Sunday, March 16, 14
19
// Iterator demo *without* Generics...
List list = new ArrayList();
for(int i = 0;i < 10;++i) {
list.add(new Integer(i));
}
Iterator iterator = list.iterator();
while(iterator.hasNext()) {
System.out.println(“i = ” + (Integer)iterator.next());
}
Sunday, March 16, 14
20
// Iterator demo *with* Generics...
List<Integer> list = new ArrayList<Integer>();
for(int i = 0;i < 10;++i) {
list.add(new Integer(i));
}
Iterator<Integer> iterator = list.iterator();
while(iterator.hasNext()) {
System.out.println(“i = ” + iterator.next());
}
Sunday, March 16, 14
21
// Defining Simple Generics
public interface List<E> {
add(E x);
}
public interface Iterator<E> {
E next();
boolean hasNext();
}
Sunday, March 16, 14
Java Database
Connectivity (JDBC)
22
Sunday, March 16, 14
What is JDBC?
• A built-in API to access data sources
• relational databases
• spreadsheets
• flat files
• The JDK includes a JDBC-ODBC bridge for
use with ODBC data sources
• type 1 driver
23
Sunday, March 16, 14
Java Database
Connectivity (1)
• Install database driver and/or ODBC driver
• Establish a connection to the database:
• Class.forName(driverName);
• Connection connection =
DriverManager.getConnection();
24
Sunday, March 16, 14
Java Database
Connectivity (2)
• Create JDBC statement:
•Statement statement =
connection.createStatement();
• Obtain result set:
• Result result =
statement.execute();
• Result result =
statement.executeQuery();
25
Sunday, March 16, 14
26
// JDBC example
import java.sql.*;
public class DatabaseDemo {
public static void main(String[] args) {
String sql = “SELECT * FROM timeZones”;
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection connection =
DriverManager.getConnection(“jdbc:odbc:timezones”,””,””);
Statement statement = connection.createStatement();
ResultSet result = statement.executeQuery(sql);
while(result.next()) {
System.out.println(result.getDouble(2) + “ “
+ result.getDouble(3));
}
connection.close();
}
}
Sunday, March 16, 14
Java Collections
Framework
27
Sunday, March 16, 14
What are Java
Collections? (1)
• A single object that groups together
multiple elements
• Collections are used to:
• store
• retrieve
• manipulate
28
Sunday, March 16, 14
What is the Java
Collection Framework?
• A unified architecture for collections
• All collection frameworks contain:
• interfaces
• implementations
• algorithms
• Inspired by the C++ Standard Template
Library
29
Sunday, March 16, 14
What is a Collection?
• A single object that groups together
multiple elements
• sometimes referred to as a container
• Containers before Java 2 were a
disappointment:
• only four containers
• no built-in algorithms
30
Sunday, March 16, 14
Collections (1)
• Implement the Collection interface
• Built-in implementations:
• List
• Set
31
Sunday, March 16, 14
Collections (2)
• Lists
• ordered sequences that support direct
indexing and bi-directional traversal
• Sets
• an unordered receptacle for elements
that conform to the notion of
mathematical set
32
Sunday, March 16, 14
33
// the Collection interface
public interface Collection<E> extends Iterable<E>{
boolean add(E e);
boolean addAll(Collection<? extends E> collection);
void clear();
boolean contains(Object object);
boolean containsAll(Collection<?> collection);
boolean equals(Object object);
int hashCode();
boolean isEmpty();
Iterator<E> iterator();
boolean remove(Object object);
boolean removeAll(Collection<?> collection);
boolean retainAll(Collection<?> collection);
int size();
Object[] toArray();
<T> T[] toArray(T[] array);
}
Sunday, March 16, 14
Iterators
• Used to access elements within an ordered
sequence
• All collections support iterators
• Traversal depends on the collection
• All iterators are fail-fast
• if the collection is changed by something other
than the iterator, the iterator becomes invalid
34
Sunday, March 16, 14
35
// Iterator demo
import java.util.*;
List<Integer> list = new ArrayList<Integer>();
for(int i = 0;i < 9;++i) {
list.add(new Integer(i));
}
Iterator iterator = list.iterator();
while(iterator.hasNext()) {
System.out.println(iterator.next());
}
0 1 2 3 4 5 6 7 8
current last
Sunday, March 16, 14
Live Demo!
36
Sunday, March 16, 14
Java IDEs (1)
• IntelliJ
• jetbrains.com/idea
• Eclipse
• eclipse.org
37
Sunday, March 16, 14
Java IDEs (2)
• NetBeans
• netbeans.org
• JBuilder
• embarcadero.com/products/
jbuilder
38
Sunday, March 16, 14
Local Java User Groups
(1)
• ACGNJ Java Users Group
• facilitated by Mike Redlich
• javasig.org
• Princeton Java Users Group
• facilitated byYakov Fain
• meetup.com/NJFlex
39
Sunday, March 16, 14
Local Java User Groups
(2)
• NewYork Java SIG
• facilitated by Frank Greco
• javasig.com
• Capital District Java Developers Network
• facilitated by Dan Patsey
• cdjdn.com
40
Sunday, March 16, 14
Further Reading
41
Sunday, March 16, 14
Upcoming Events (1)
• Trenton Computer Festival
• March 14-15, 2014
• tcf-nj.org
• Emerging Technologies for the Enterprise
• April 22-23, 2014
• phillyemergingtech.com
42
Sunday, March 16, 14
43
Upcoming Events (2)
Sunday, March 16, 14
44
Thanks!
mike@redlich.net
@mpredli
javasig.org
Sunday, March 16, 14

Weitere ähnliche Inhalte

Was ist angesagt?

Session 22 - Java IO, Serialization
Session 22 - Java IO, SerializationSession 22 - Java IO, Serialization
Session 22 - Java IO, SerializationPawanMM
 
How I stopped worrying about and loved DumpRenderTree
How I stopped worrying about and loved DumpRenderTreeHow I stopped worrying about and loved DumpRenderTree
How I stopped worrying about and loved DumpRenderTreeHajime Morrita
 
Session 24 - JDBC, Intro to Enterprise Java
Session 24 - JDBC, Intro to Enterprise JavaSession 24 - JDBC, Intro to Enterprise Java
Session 24 - JDBC, Intro to Enterprise JavaPawanMM
 
Java Serialization Deep Dive
Java Serialization Deep DiveJava Serialization Deep Dive
Java Serialization Deep DiveMartijn Dashorst
 
Development of Java tools using SWT and WALA af Hans Søndergaard, ViaUC
Development of Java tools using SWT and WALA af Hans Søndergaard, ViaUCDevelopment of Java tools using SWT and WALA af Hans Søndergaard, ViaUC
Development of Java tools using SWT and WALA af Hans Søndergaard, ViaUCInfinIT - Innovationsnetværket for it
 
4java Basic Syntax
4java Basic Syntax4java Basic Syntax
4java Basic SyntaxAdil Jafri
 
Web scraping using scrapy - zekeLabs
Web scraping using scrapy - zekeLabsWeb scraping using scrapy - zekeLabs
Web scraping using scrapy - zekeLabszekeLabs Technologies
 
Java - Singleton Pattern
Java - Singleton PatternJava - Singleton Pattern
Java - Singleton PatternCharles Casadei
 
Moving to Module: Issues & Solutions
Moving to Module: Issues & SolutionsMoving to Module: Issues & Solutions
Moving to Module: Issues & SolutionsYuichi Sakuraba
 
Java OOP Programming language (Part 8) - Java Database JDBC
Java OOP Programming language (Part 8) - Java Database JDBCJava OOP Programming language (Part 8) - Java Database JDBC
Java OOP Programming language (Part 8) - Java Database JDBCOUM SAOKOSAL
 
Automated Discovery of Deserialization Gadget Chains
Automated Discovery of Deserialization Gadget ChainsAutomated Discovery of Deserialization Gadget Chains
Automated Discovery of Deserialization Gadget ChainsPriyanka Aash
 
Deserialization vulnerabilities
Deserialization vulnerabilitiesDeserialization vulnerabilities
Deserialization vulnerabilitiesGreenD0g
 
Java OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - CollectionJava OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - CollectionOUM SAOKOSAL
 
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...joaomatosf_
 
Java7 New Features and Code Examples
Java7 New Features and Code ExamplesJava7 New Features and Code Examples
Java7 New Features and Code ExamplesNaresh Chintalcheru
 

Was ist angesagt? (19)

Session 22 - Java IO, Serialization
Session 22 - Java IO, SerializationSession 22 - Java IO, Serialization
Session 22 - Java IO, Serialization
 
How I stopped worrying about and loved DumpRenderTree
How I stopped worrying about and loved DumpRenderTreeHow I stopped worrying about and loved DumpRenderTree
How I stopped worrying about and loved DumpRenderTree
 
Session 24 - JDBC, Intro to Enterprise Java
Session 24 - JDBC, Intro to Enterprise JavaSession 24 - JDBC, Intro to Enterprise Java
Session 24 - JDBC, Intro to Enterprise Java
 
Java Serialization Deep Dive
Java Serialization Deep DiveJava Serialization Deep Dive
Java Serialization Deep Dive
 
Fixing the Java Serialization Mess
Fixing the Java Serialization Mess Fixing the Java Serialization Mess
Fixing the Java Serialization Mess
 
4 gouping object
4 gouping object4 gouping object
4 gouping object
 
Chapter iii(oop)
Chapter iii(oop)Chapter iii(oop)
Chapter iii(oop)
 
Development of Java tools using SWT and WALA af Hans Søndergaard, ViaUC
Development of Java tools using SWT and WALA af Hans Søndergaard, ViaUCDevelopment of Java tools using SWT and WALA af Hans Søndergaard, ViaUC
Development of Java tools using SWT and WALA af Hans Søndergaard, ViaUC
 
4java Basic Syntax
4java Basic Syntax4java Basic Syntax
4java Basic Syntax
 
Web scraping using scrapy - zekeLabs
Web scraping using scrapy - zekeLabsWeb scraping using scrapy - zekeLabs
Web scraping using scrapy - zekeLabs
 
Java - Singleton Pattern
Java - Singleton PatternJava - Singleton Pattern
Java - Singleton Pattern
 
Moving to Module: Issues & Solutions
Moving to Module: Issues & SolutionsMoving to Module: Issues & Solutions
Moving to Module: Issues & Solutions
 
Java OOP Programming language (Part 8) - Java Database JDBC
Java OOP Programming language (Part 8) - Java Database JDBCJava OOP Programming language (Part 8) - Java Database JDBC
Java OOP Programming language (Part 8) - Java Database JDBC
 
Automated Discovery of Deserialization Gadget Chains
Automated Discovery of Deserialization Gadget ChainsAutomated Discovery of Deserialization Gadget Chains
Automated Discovery of Deserialization Gadget Chains
 
Deserialization vulnerabilities
Deserialization vulnerabilitiesDeserialization vulnerabilities
Deserialization vulnerabilities
 
Java OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - CollectionJava OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - Collection
 
Java Programming - 06 java file io
Java Programming - 06 java file ioJava Programming - 06 java file io
Java Programming - 06 java file io
 
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
 
Java7 New Features and Code Examples
Java7 New Features and Code ExamplesJava7 New Features and Code Examples
Java7 New Features and Code Examples
 

Andere mochten auch

Data Structures by Yaman Singhania
Data Structures by Yaman SinghaniaData Structures by Yaman Singhania
Data Structures by Yaman SinghaniaYaman Singhania
 
Paginas libres
Paginas libresPaginas libres
Paginas libresINGRID
 
Power point Presentation
Power point PresentationPower point Presentation
Power point PresentationSumesh SV
 
Kerajaankalingga
KerajaankalinggaKerajaankalingga
KerajaankalinggaPak Yayak
 
University Assignment Literacy Assessment
University Assignment Literacy AssessmentUniversity Assignment Literacy Assessment
University Assignment Literacy Assessmentmforrester
 
Art exibition
Art exibitionArt exibition
Art exibitionmaleemoha
 
POWER POINT PRESENTATION
POWER POINT PRESENTATIONPOWER POINT PRESENTATION
POWER POINT PRESENTATIONSumesh SV
 
Getting Started with MongoDB
Getting Started with MongoDBGetting Started with MongoDB
Getting Started with MongoDBMichael Redlich
 
Madhusha B Ed
Madhusha B Ed Madhusha B Ed
Madhusha B Ed Sumesh SV
 
Classification of Elements Powerpoint Presentation by Computer Careers
Classification of Elements Powerpoint Presentation by Computer CareersClassification of Elements Powerpoint Presentation by Computer Careers
Classification of Elements Powerpoint Presentation by Computer CareersYaman Singhania
 
Lm catering services
Lm catering servicesLm catering services
Lm catering servicesPaulaMaeRamos
 
Clarke slideshare
Clarke slideshareClarke slideshare
Clarke slidesharemleigh7
 
Powerpoint Presentation
Powerpoint PresentationPowerpoint Presentation
Powerpoint PresentationSumesh SV
 
EFFECTS OF SOCIAL MEDIA ON YOUTH
EFFECTS OF SOCIAL MEDIA ON YOUTHEFFECTS OF SOCIAL MEDIA ON YOUTH
EFFECTS OF SOCIAL MEDIA ON YOUTHYaman Singhania
 
POWR POINT PRESENTATION
POWR POINT PRESENTATIONPOWR POINT PRESENTATION
POWR POINT PRESENTATIONSumesh SV
 

Andere mochten auch (20)

Data Structures by Yaman Singhania
Data Structures by Yaman SinghaniaData Structures by Yaman Singhania
Data Structures by Yaman Singhania
 
Paginas libres
Paginas libresPaginas libres
Paginas libres
 
Power point Presentation
Power point PresentationPower point Presentation
Power point Presentation
 
Kerajaankalingga
KerajaankalinggaKerajaankalingga
Kerajaankalingga
 
University Assignment Literacy Assessment
University Assignment Literacy AssessmentUniversity Assignment Literacy Assessment
University Assignment Literacy Assessment
 
WhoIsFrancisFairley
WhoIsFrancisFairleyWhoIsFrancisFairley
WhoIsFrancisFairley
 
Art exibition
Art exibitionArt exibition
Art exibition
 
The Sleeping Beauty
The Sleeping BeautyThe Sleeping Beauty
The Sleeping Beauty
 
Mata
MataMata
Mata
 
POWER POINT PRESENTATION
POWER POINT PRESENTATIONPOWER POINT PRESENTATION
POWER POINT PRESENTATION
 
Getting Started with MongoDB
Getting Started with MongoDBGetting Started with MongoDB
Getting Started with MongoDB
 
Madhusha B Ed
Madhusha B Ed Madhusha B Ed
Madhusha B Ed
 
Classification of Elements Powerpoint Presentation by Computer Careers
Classification of Elements Powerpoint Presentation by Computer CareersClassification of Elements Powerpoint Presentation by Computer Careers
Classification of Elements Powerpoint Presentation by Computer Careers
 
Lm catering services
Lm catering servicesLm catering services
Lm catering services
 
huruf prasekolah
huruf prasekolahhuruf prasekolah
huruf prasekolah
 
Clarke slideshare
Clarke slideshareClarke slideshare
Clarke slideshare
 
Powerpoint Presentation
Powerpoint PresentationPowerpoint Presentation
Powerpoint Presentation
 
EFFECTS OF SOCIAL MEDIA ON YOUTH
EFFECTS OF SOCIAL MEDIA ON YOUTHEFFECTS OF SOCIAL MEDIA ON YOUTH
EFFECTS OF SOCIAL MEDIA ON YOUTH
 
POWR POINT PRESENTATION
POWR POINT PRESENTATIONPOWR POINT PRESENTATION
POWR POINT PRESENTATION
 
Menupra1
Menupra1Menupra1
Menupra1
 

Ähnlich wie Java Advanced Features (TCF 2014)

Getting Started with Java (TCF 2014)
Getting Started with Java (TCF 2014)Getting Started with Java (TCF 2014)
Getting Started with Java (TCF 2014)Michael Redlich
 
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Martijn Verburg
 
Introduction to Object-Oriented Programming & Design Principles (TCF 2014)
Introduction to Object-Oriented Programming & Design Principles (TCF 2014)Introduction to Object-Oriented Programming & Design Principles (TCF 2014)
Introduction to Object-Oriented Programming & Design Principles (TCF 2014)Michael Redlich
 
Intro to JavaScript Testing
Intro to JavaScript TestingIntro to JavaScript Testing
Intro to JavaScript TestingRan Mizrahi
 
Getting Started with Java
Getting Started with JavaGetting Started with Java
Getting Started with JavaMichael Redlich
 
Getting Started with C++ (TCF 2014)
Getting Started with C++ (TCF 2014)Getting Started with C++ (TCF 2014)
Getting Started with C++ (TCF 2014)Michael Redlich
 
55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx France55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx FranceDavid Delabassee
 
DevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern JavaDevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern JavaHenri Tremblay
 
C++ Advanced Features (TCF 2014)
C++ Advanced Features (TCF 2014)C++ Advanced Features (TCF 2014)
C++ Advanced Features (TCF 2014)Michael Redlich
 
Testcontainers - Geekout EE 2017 presentation
Testcontainers - Geekout EE 2017 presentationTestcontainers - Geekout EE 2017 presentation
Testcontainers - Geekout EE 2017 presentationRichard North
 
Atlassian Groovy Plugins
Atlassian Groovy PluginsAtlassian Groovy Plugins
Atlassian Groovy PluginsPaul King
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevMattias Karlsson
 
Implementing Quality on Java projects
Implementing Quality on Java projectsImplementing Quality on Java projects
Implementing Quality on Java projectsVincent Massol
 
Adv java unit 1 M.Sc CS.pdf
Adv java unit 1 M.Sc CS.pdfAdv java unit 1 M.Sc CS.pdf
Adv java unit 1 M.Sc CS.pdfKALAISELVI P
 
First adoption hackathon at BGJUG
First adoption hackathon at BGJUGFirst adoption hackathon at BGJUG
First adoption hackathon at BGJUGIvan Ivanov
 
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javac
Jug trojmiasto 2014.04.24  tricky stuff in java grammar and javacJug trojmiasto 2014.04.24  tricky stuff in java grammar and javac
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javacAnna Brzezińska
 

Ähnlich wie Java Advanced Features (TCF 2014) (20)

Getting Started with Java (TCF 2014)
Getting Started with Java (TCF 2014)Getting Started with Java (TCF 2014)
Getting Started with Java (TCF 2014)
 
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)
 
Introduction to Object-Oriented Programming & Design Principles (TCF 2014)
Introduction to Object-Oriented Programming & Design Principles (TCF 2014)Introduction to Object-Oriented Programming & Design Principles (TCF 2014)
Introduction to Object-Oriented Programming & Design Principles (TCF 2014)
 
Intro to JavaScript Testing
Intro to JavaScript TestingIntro to JavaScript Testing
Intro to JavaScript Testing
 
JDBC Part - 2
JDBC Part - 2JDBC Part - 2
JDBC Part - 2
 
Getting Started with Java
Getting Started with JavaGetting Started with Java
Getting Started with Java
 
Getting Started with C++ (TCF 2014)
Getting Started with C++ (TCF 2014)Getting Started with C++ (TCF 2014)
Getting Started with C++ (TCF 2014)
 
55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx France55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx France
 
Java
JavaJava
Java
 
DevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern JavaDevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern Java
 
55 New Features in Java 7
55 New Features in Java 755 New Features in Java 7
55 New Features in Java 7
 
C++ Advanced Features (TCF 2014)
C++ Advanced Features (TCF 2014)C++ Advanced Features (TCF 2014)
C++ Advanced Features (TCF 2014)
 
Testcontainers - Geekout EE 2017 presentation
Testcontainers - Geekout EE 2017 presentationTestcontainers - Geekout EE 2017 presentation
Testcontainers - Geekout EE 2017 presentation
 
Atlassian Groovy Plugins
Atlassian Groovy PluginsAtlassian Groovy Plugins
Atlassian Groovy Plugins
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
 
Implementing Quality on Java projects
Implementing Quality on Java projectsImplementing Quality on Java projects
Implementing Quality on Java projects
 
Jdbc day-1
Jdbc day-1Jdbc day-1
Jdbc day-1
 
Adv java unit 1 M.Sc CS.pdf
Adv java unit 1 M.Sc CS.pdfAdv java unit 1 M.Sc CS.pdf
Adv java unit 1 M.Sc CS.pdf
 
First adoption hackathon at BGJUG
First adoption hackathon at BGJUGFirst adoption hackathon at BGJUG
First adoption hackathon at BGJUG
 
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javac
Jug trojmiasto 2014.04.24  tricky stuff in java grammar and javacJug trojmiasto 2014.04.24  tricky stuff in java grammar and javac
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javac
 

Mehr von Michael Redlich

Getting Started with GitHub
Getting Started with GitHubGetting Started with GitHub
Getting Started with GitHubMichael Redlich
 
Building Microservices with Micronaut: A Full-Stack JVM-Based Framework
Building Microservices with Micronaut:  A Full-Stack JVM-Based FrameworkBuilding Microservices with Micronaut:  A Full-Stack JVM-Based Framework
Building Microservices with Micronaut: A Full-Stack JVM-Based FrameworkMichael Redlich
 
Building Microservices with Helidon: Oracle's New Java Microservices Framework
Building Microservices with Helidon:  Oracle's New Java Microservices FrameworkBuilding Microservices with Helidon:  Oracle's New Java Microservices Framework
Building Microservices with Helidon: Oracle's New Java Microservices FrameworkMichael Redlich
 
Introduction to Object Oriented Programming & Design Principles
Introduction to Object Oriented Programming & Design PrinciplesIntroduction to Object Oriented Programming & Design Principles
Introduction to Object Oriented Programming & Design PrinciplesMichael Redlich
 
Getting Started with C++
Getting Started with C++Getting Started with C++
Getting Started with C++Michael Redlich
 
Introduction to Object Oriented Programming &amp; Design Principles
Introduction to Object Oriented Programming &amp; Design PrinciplesIntroduction to Object Oriented Programming &amp; Design Principles
Introduction to Object Oriented Programming &amp; Design PrinciplesMichael Redlich
 
Getting started with C++
Getting started with C++Getting started with C++
Getting started with C++Michael Redlich
 
Building Realtime Access to Data Apps with jOOQ
Building Realtime Access to Data Apps with jOOQBuilding Realtime Access to Data Apps with jOOQ
Building Realtime Access to Data Apps with jOOQMichael Redlich
 
Building Realtime Access Data Apps with Speedment (TCF ITPC 2017)
Building Realtime Access Data Apps with Speedment (TCF ITPC 2017)Building Realtime Access Data Apps with Speedment (TCF ITPC 2017)
Building Realtime Access Data Apps with Speedment (TCF ITPC 2017)Michael Redlich
 
Building Realtime Web Apps with Angular and Meteor
Building Realtime Web Apps with Angular and MeteorBuilding Realtime Web Apps with Angular and Meteor
Building Realtime Web Apps with Angular and MeteorMichael Redlich
 
Getting Started with Meteor (TCF ITPC 2014)
Getting Started with Meteor (TCF ITPC 2014)Getting Started with Meteor (TCF ITPC 2014)
Getting Started with Meteor (TCF ITPC 2014)Michael Redlich
 
Getting Started with MongoDB (TCF ITPC 2014)
Getting Started with MongoDB (TCF ITPC 2014)Getting Started with MongoDB (TCF ITPC 2014)
Getting Started with MongoDB (TCF ITPC 2014)Michael Redlich
 
Getting Started with Meteor
Getting Started with MeteorGetting Started with Meteor
Getting Started with MeteorMichael Redlich
 

Mehr von Michael Redlich (15)

Getting Started with GitHub
Getting Started with GitHubGetting Started with GitHub
Getting Started with GitHub
 
Building Microservices with Micronaut: A Full-Stack JVM-Based Framework
Building Microservices with Micronaut:  A Full-Stack JVM-Based FrameworkBuilding Microservices with Micronaut:  A Full-Stack JVM-Based Framework
Building Microservices with Micronaut: A Full-Stack JVM-Based Framework
 
Building Microservices with Helidon: Oracle's New Java Microservices Framework
Building Microservices with Helidon:  Oracle's New Java Microservices FrameworkBuilding Microservices with Helidon:  Oracle's New Java Microservices Framework
Building Microservices with Helidon: Oracle's New Java Microservices Framework
 
Introduction to Object Oriented Programming & Design Principles
Introduction to Object Oriented Programming & Design PrinciplesIntroduction to Object Oriented Programming & Design Principles
Introduction to Object Oriented Programming & Design Principles
 
Getting Started with C++
Getting Started with C++Getting Started with C++
Getting Started with C++
 
C++ Advanced Features
C++ Advanced FeaturesC++ Advanced Features
C++ Advanced Features
 
Introduction to Object Oriented Programming &amp; Design Principles
Introduction to Object Oriented Programming &amp; Design PrinciplesIntroduction to Object Oriented Programming &amp; Design Principles
Introduction to Object Oriented Programming &amp; Design Principles
 
Getting started with C++
Getting started with C++Getting started with C++
Getting started with C++
 
C++ Advanced Features
C++ Advanced FeaturesC++ Advanced Features
C++ Advanced Features
 
Building Realtime Access to Data Apps with jOOQ
Building Realtime Access to Data Apps with jOOQBuilding Realtime Access to Data Apps with jOOQ
Building Realtime Access to Data Apps with jOOQ
 
Building Realtime Access Data Apps with Speedment (TCF ITPC 2017)
Building Realtime Access Data Apps with Speedment (TCF ITPC 2017)Building Realtime Access Data Apps with Speedment (TCF ITPC 2017)
Building Realtime Access Data Apps with Speedment (TCF ITPC 2017)
 
Building Realtime Web Apps with Angular and Meteor
Building Realtime Web Apps with Angular and MeteorBuilding Realtime Web Apps with Angular and Meteor
Building Realtime Web Apps with Angular and Meteor
 
Getting Started with Meteor (TCF ITPC 2014)
Getting Started with Meteor (TCF ITPC 2014)Getting Started with Meteor (TCF ITPC 2014)
Getting Started with Meteor (TCF ITPC 2014)
 
Getting Started with MongoDB (TCF ITPC 2014)
Getting Started with MongoDB (TCF ITPC 2014)Getting Started with MongoDB (TCF ITPC 2014)
Getting Started with MongoDB (TCF ITPC 2014)
 
Getting Started with Meteor
Getting Started with MeteorGetting Started with Meteor
Getting Started with Meteor
 

Kürzlich hochgeladen

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 

Kürzlich hochgeladen (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 

Java Advanced Features (TCF 2014)

  • 1. 1 Java Advanced Features Trenton Computer Festival March 15, 2014 Michael P. Redlich @mpredli about.me/mpredli/ Sunday, March 16, 14
  • 2. Who’s Mike? • BS in CS from • “Petrochemical Research Organization” • Ai-Logix, Inc. (now AudioCodes) • Amateur Computer Group of New Jersey • Publications • Presentations 2 Sunday, March 16, 14
  • 3. Objectives (1) • Java Beans • Exception Handling • Generics • Java Database Connectivity • Java Collections Framework 3 Sunday, March 16, 14
  • 5. What are Java Beans? • A method for developing reusable Java components • Also known as POJOs (Plain Old Java Objects) • Easily store and retrieve information 5 Sunday, March 16, 14
  • 6. Java Beans (1) • A Java class is considered a bean when it: • implements interface Serializable • defines a default constructor • defines properly named getter/setter methods 6 Sunday, March 16, 14
  • 7. Java Beans (2) • Getter/Setter methods: • return (get) and assign (set) a bean’s data members • Specified naming convention: •getMember •setMember •isValid 7 Sunday, March 16, 14
  • 8. 8 // PersonBean class (partial listing) public class PersonBean implements Serializable { private static final long serialVersionUID = 7526472295622776147L; private String lastName; private String firstName; private boolean valid; public PersonBean() { } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } // getter/setter for firstName public boolean isValid() { return valid; } } Sunday, March 16, 14
  • 10. What is Exception Handling? • A more robust method for handling errors than fastidiously checking for error codes • error code checking is tedious and can obscure program logic 10 Sunday, March 16, 14
  • 11. Exception Handling (1) • Throw Expression: • raises the exception • Try Block: • contains a throw expression or a method that throws an exception 11 Sunday, March 16, 14
  • 12. Exception Handling (2) • Catch Clause(s): • handles the exception • defined immediately after the try block • Finally Clause: • always gets called regardless of where exception is caught • sets something back to its original state 12 Sunday, March 16, 14
  • 13. Java Exception Model (1) • Checked Exceptions • enforced by the compiler • Unchecked Exceptions • recommended, but not enforced by the compiler 13 Sunday, March 16, 14
  • 14. Java Exception Model (2) • Exception Specification • specify what type of exception(s) a method will throw • Termination vs. Resumption semantics 14 Sunday, March 16, 14
  • 15. 15 // ExceptionDemo class public class ExceptionDemo { public static void main(String[] args) { try { initialize(); } catch(Exception exception) { exception.printStackTrace(); } public void initialize() throws Exception { // contains code that may throw an exception of type Exception } } Sunday, March 16, 14
  • 17. What are Generics? • A mechanism to ensure type safety in Java collections • introduced in Java 5 • Similar concept to C++ Template mechanism 17 Sunday, March 16, 14
  • 18. Generics (1) • Prototype: • visibilityModifier class | interface name<Type> {} 18 Sunday, March 16, 14
  • 19. 19 // Iterator demo *without* Generics... List list = new ArrayList(); for(int i = 0;i < 10;++i) { list.add(new Integer(i)); } Iterator iterator = list.iterator(); while(iterator.hasNext()) { System.out.println(“i = ” + (Integer)iterator.next()); } Sunday, March 16, 14
  • 20. 20 // Iterator demo *with* Generics... List<Integer> list = new ArrayList<Integer>(); for(int i = 0;i < 10;++i) { list.add(new Integer(i)); } Iterator<Integer> iterator = list.iterator(); while(iterator.hasNext()) { System.out.println(“i = ” + iterator.next()); } Sunday, March 16, 14
  • 21. 21 // Defining Simple Generics public interface List<E> { add(E x); } public interface Iterator<E> { E next(); boolean hasNext(); } Sunday, March 16, 14
  • 23. What is JDBC? • A built-in API to access data sources • relational databases • spreadsheets • flat files • The JDK includes a JDBC-ODBC bridge for use with ODBC data sources • type 1 driver 23 Sunday, March 16, 14
  • 24. Java Database Connectivity (1) • Install database driver and/or ODBC driver • Establish a connection to the database: • Class.forName(driverName); • Connection connection = DriverManager.getConnection(); 24 Sunday, March 16, 14
  • 25. Java Database Connectivity (2) • Create JDBC statement: •Statement statement = connection.createStatement(); • Obtain result set: • Result result = statement.execute(); • Result result = statement.executeQuery(); 25 Sunday, March 16, 14
  • 26. 26 // JDBC example import java.sql.*; public class DatabaseDemo { public static void main(String[] args) { String sql = “SELECT * FROM timeZones”; Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”); Connection connection = DriverManager.getConnection(“jdbc:odbc:timezones”,””,””); Statement statement = connection.createStatement(); ResultSet result = statement.executeQuery(sql); while(result.next()) { System.out.println(result.getDouble(2) + “ “ + result.getDouble(3)); } connection.close(); } } Sunday, March 16, 14
  • 28. What are Java Collections? (1) • A single object that groups together multiple elements • Collections are used to: • store • retrieve • manipulate 28 Sunday, March 16, 14
  • 29. What is the Java Collection Framework? • A unified architecture for collections • All collection frameworks contain: • interfaces • implementations • algorithms • Inspired by the C++ Standard Template Library 29 Sunday, March 16, 14
  • 30. What is a Collection? • A single object that groups together multiple elements • sometimes referred to as a container • Containers before Java 2 were a disappointment: • only four containers • no built-in algorithms 30 Sunday, March 16, 14
  • 31. Collections (1) • Implement the Collection interface • Built-in implementations: • List • Set 31 Sunday, March 16, 14
  • 32. Collections (2) • Lists • ordered sequences that support direct indexing and bi-directional traversal • Sets • an unordered receptacle for elements that conform to the notion of mathematical set 32 Sunday, March 16, 14
  • 33. 33 // the Collection interface public interface Collection<E> extends Iterable<E>{ boolean add(E e); boolean addAll(Collection<? extends E> collection); void clear(); boolean contains(Object object); boolean containsAll(Collection<?> collection); boolean equals(Object object); int hashCode(); boolean isEmpty(); Iterator<E> iterator(); boolean remove(Object object); boolean removeAll(Collection<?> collection); boolean retainAll(Collection<?> collection); int size(); Object[] toArray(); <T> T[] toArray(T[] array); } Sunday, March 16, 14
  • 34. Iterators • Used to access elements within an ordered sequence • All collections support iterators • Traversal depends on the collection • All iterators are fail-fast • if the collection is changed by something other than the iterator, the iterator becomes invalid 34 Sunday, March 16, 14
  • 35. 35 // Iterator demo import java.util.*; List<Integer> list = new ArrayList<Integer>(); for(int i = 0;i < 9;++i) { list.add(new Integer(i)); } Iterator iterator = list.iterator(); while(iterator.hasNext()) { System.out.println(iterator.next()); } 0 1 2 3 4 5 6 7 8 current last Sunday, March 16, 14
  • 37. Java IDEs (1) • IntelliJ • jetbrains.com/idea • Eclipse • eclipse.org 37 Sunday, March 16, 14
  • 38. Java IDEs (2) • NetBeans • netbeans.org • JBuilder • embarcadero.com/products/ jbuilder 38 Sunday, March 16, 14
  • 39. Local Java User Groups (1) • ACGNJ Java Users Group • facilitated by Mike Redlich • javasig.org • Princeton Java Users Group • facilitated byYakov Fain • meetup.com/NJFlex 39 Sunday, March 16, 14
  • 40. Local Java User Groups (2) • NewYork Java SIG • facilitated by Frank Greco • javasig.com • Capital District Java Developers Network • facilitated by Dan Patsey • cdjdn.com 40 Sunday, March 16, 14
  • 42. Upcoming Events (1) • Trenton Computer Festival • March 14-15, 2014 • tcf-nj.org • Emerging Technologies for the Enterprise • April 22-23, 2014 • phillyemergingtech.com 42 Sunday, March 16, 14