1162 JDK 5.0 Features Christian Kemper Principal Architect Borland.

Slides:



Advertisements
Similar presentations
Lists and the Collection Interface Chapter 4. Chapter Objectives To become familiar with the List interface To understand how to write an array-based.
Advertisements

01/26/07© 2006, uXcomm Inc. Slide 1 Tuesday Brown Bag with Howard Abrams New Java Features (from Java 5 & 6)
New features in JDK 1.5 Can these new and complex features simplify Java development?
1-May-15 Java 1.5. Reason for changes “The new language features all have one thing in common: they take some common idiom and provide linguistic support.
Lab#1 (14/3/1431h) Introduction To java programming cs425
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Java 1.5 & Effective Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Lists and the Collection Interface Chapter 4. Chapter 4: Lists and the Collection Interface2 Chapter Objectives To become familiar with the List interface.
Fall 2007CS 2251 Lists and the Collection Interface Chapter 4.
J2SE 5.0 New Features. J2SE 5.0 aka JDK 1.5 aka Tiger.
Java Review Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles C/C++ Emery Berger and Mark Corner University of Massachusetts.
15-Jul-15 Generics. ArrayList s and arrays A ArrayList is like an array of Object s, but... Arrays use [ ] syntax; ArrayList s use object syntax An ArrayList.
Lecture 1: Overview of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed.
Peter Juszczyk CS 492/493 - ISGS. // Is this C# or Java? class TestApp { static void Main() { int counter = 0; counter++; } } The answer is C# - In C#
Platforms and tools for Web Services and Mobile Applications Introduction to C# Bent Thomsen Aalborg University 3rd and 4th of June 2004.
Differences between C# and C++ Dr. Catherine Stringfellow Dr. Stewart Carpenter.
OOP Languages: Java vs C++
Parallel Programming in Java with Shared Memory Directives.
Lecturer PEN PHIROM Tel : Web site: Lecturer PEN PHIROM Tel :
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Java Generics.
Implement High-level Program Language on JVM CSCE 531 ZHONGHAO LIU ZHONGHAO LIU XIAO LIN.
P Object type and wrapper classes p Object methods p Generic classes p Interfaces and iterators Generic Programming Data Structures and Other Objects Using.
Putting it all together: LINQ as an Example. The Problem: SQL in Code Programs often connect to database servers. Database servers only “speak” SQL. Programs.
Effective Java: Generics Last Updated: Spring 2009.
GENERIC COLLECTIONS. Type-Wrapper Classes  Each primitive type has a corresponding type- wrapper class (in package java.lang).  These classes are called.
Introduction and Features of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++
24-Oct-15 Java Java beta 1 (“Tiger”) Released February 4, Themes Ease of Development Scalability.
Applied Computing Technology Laboratory QuickStart C# Learning to Program in C# Amy Roberge & John Linehan November 7, 2005.
Hoang Anh Viet Hà Nội University of Technology Chapter 1. Introduction to C# Programming.
Object Based Programming Chapter 8. 2 In This Chapter We will learn about classes Garbage Collection Data Abstraction and encapsulation.
Java 5 Part 1 CSE301 University of Sunderland Harry Erwin, PhD.
C# EMILEE KING. HISTORY OF C# In the late 1990’s Microsoft recognized the need to be able to develop applications that can run on multiple operating system.
Java development environment and Review of Java. Eclipse TM Intergrated Development Environment (IDE) Running Eclipse: Warning: Never check the “Use this.
© Keren Kalif Advanced Java Topics Written by Keren Kalif, Edited by Liron Blecher.
Generic Programming  Object Type  Autoboxing  Bag of Objects  JCL Collections  Nodes of Objects  Iterators.
CompSci 100E 40.1 Java 5 New Features  Generics  Enhanced for loop  Autoboxing/unboxing  Typesafe enums  Other  Varargs  Static Import  Metadata.
Java 1.5 The New Java Mike Orsega Central Carolina CC.
Objects First With Java A Practical Introduction Using BlueJ Supplementary Material for Java
 Pearson Education, Inc. All rights reserved Classes and Objects: A Deeper Look.
Java 5 Part 2 CSE301 University of Sunderland Harry Erwin, PhD.
Georgia Institute of Technology What is new in Java 5.0 (1.5)? Barb Ericson Georgia Institute of Technology June 2006.
©SoftMoore ConsultingSlide 1 Generics “Generics constitute the most significant change in the Java programming language since the 1.0 release.” – Cay Horstmann.
Object Oriented Software Development 4. C# data types, objects and references.
3246 JSF Support in JBuilder 2005 Karl Ewald R&D Engineer Borland Software Corporation.
Java Generics. It is nice if we could write a single sort method that could sort array of any type of elements: – Integer array, – String array, Solution:
Object Oriented Programming in Java Lecture 14. Review Quiz 1. Write a method which gets an Object and call all its available ‘get’ Methods and print.
Enterprise Java Java SE 5 TM Language Feature Enhancement Primary Source: New Features and Enhancements J2SE 5.0
1 CSC 2053 New from AutoBoxing 3 Before J2SE 5.0, working with primitive types required the repetitive work of converting between the primitive.
Introduction to C# By: Abir Ghattas Michel Barakat.
Bart van Kuik Application Developer Oracle Corporation.
Object Oriented Programming Session # 03.  Abstraction: Process of forming of general and relevant information from a complex scenarios.  Encapsulation:
Chapter 9 Introduction to Arrays Fundamentals of Java.
Java and C# - Some Commonalities Compile into machine-independent, language- independent code which runs in a managed execution environment Garbage Collection.
Object Based Programming Chapter 8. 2 Contrast ____________________ Languages –Action oriented –Concentrate on writing ________________ –Data supports.
New Java Features Advanced Programming Techniques.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Object Oriented Programming in
Intro to Java L. Grewe.
Microsoft .NET 3. Language Innovations Pan Wuming 2017.
CS360 Windows Programming
Functional Programming with Java
Object Based Programming
Enumerations & Annotations
Enumerations & Annotations
Pointers C#, pointers can only be declared to hold the memory addresses of value types int i = 5; int *p; p = &i; *p = 10; // changes the value of i to.
Enumerations & Annotations
(Computer fundamental Lab)
Java 5 New Features 1-May-19.
Presentation transcript:

1162 JDK 5.0 Features Christian Kemper Principal Architect Borland

JDK 5.0 and JBuilder Download and configure a JDK5.0 Switch your project to use the new JDK Switch the language level to 5.0 support (generics enabled)

Java Language Changes Generics Enhanced For Autoboxing Varargs Enums Metadata

Generics Allows programmers to specify the types allowed for Collections Allows the compiler to enforce the type specifications //This should only contain Strings List stringList; //This can only contain Strings List stringList;

Generics and JBuilder Introduce Generics Refactoring Allows you to change the use of untyped Collection classes to use generics

for (Iterator i = line.iterator(); i.hasNext();) { String word = (String)i.next();... } for (String word : line){... } Enhanced for loop A new language construct for the Iterator pattern:

Enhanced for loop and JBuilder Introduce foreach refactoring Changes a regular iterator pattern into the new language construct Works best after making the Iterator itself generic

Autoboxing Essentially bridges between the “primitive” types (such as int, boolean ) and the “boxed” types (such as Integer, Boolean)... int primitive = 5; Integer boxed = primitive; int unboxed = boxed + 5;...

Autoboxing and JBuilder Introduce Auto(un)boxing Refactoring Allows you to eliminate all boxing and unboxing expression from a Java source file –new Integer(5) –boxedInt.intValue() Generated code in the class file is still the same! So no performance improvement! But: The code is easier to read and maintain

void printf(String format, Object...args);... printf(“{0} {1}\n”, “Hello”, “World!”); printf(“PI = {0}”, ); Varargs Allow a variable number of arguments for methods like printf() or Method.invoke() Internally parameters are an array of Object Compiler constructs the array for the call

Enumerations Essentially the “typesafe enum pattern” Simple C-style enumeration Can add behavior to each instance High performance EnumSet implementation using a bit-vector public enum Coin { PENNY(1), NICKEL(5); private final int value; Coin(int value) {this.value = value} }

Metadata Ability to decorate Java classes and their members with arbitrary data Retrieve values –From source files –From class files –At runtime using Test{}

Metadata Auto generate boilerplate code Generate other files: –Deployment descriptor Replace naming patterns public class Foo { public static void bar() public static void testBar() {... }

API changes Updated APIs to take advantage of new language features: –Generics in the Collection framework –Varargs for System.out.printf(), Method.invoke(), String.format() Other improvements: –boolean String.contains()

Concurrency Utilities Powerful framework for concurrent programming Essentially Doug Lea’s Concurrency Utilities rolled into the JDK Updated to take advantage of the new memory model Updated to use generics where possible

Concurrency Utilities Task scheduling framework –Single thread, thread pool, multiple threads Synchronization primitives –semaphores, mutexes etc. Locks with timeouts Concurrent collections –Map, List and Queue Atomic variables (references and primitives) –high performance –atomic arithmetic and “compare-and-set”

Servicability Agent Allows you to introspect a running VM –Find the process id using jps –Attach to the process –Inspect the stack –Detach to let the process continue

Class Data Sharing Shares the data in the runtime class files between multiple instances of the VM Does not work on Windows 95/98/ME Improves startup performance –Shared class data gets memory mapped into each running VM instead of reading from jar and converting Reduces memory footprint –Shared data is ready to be used by HotSpot –Only one in memory representation

Garbage Collection Performance improvements: –Parallel collector for server VM on server class machines –Improved defaults for server class machines “Ergonomics” can tune the garbage collector according to specified targets (throughput vs. latency)

Questions?

Thank You 1162 JDK 5.0 Features Please fill out the speaker evaluation You can contact me further at …