We help IT Professionals succeed at work.

new features in jdk5.0

jaggernat
jaggernat asked
on
699 Views
Last Modified: 2008-01-09
hi guys

I am currently using jdk 1.4.2 and would like to upgrade to jdk 5.0

I would like to know what are the new features available and the coding conventions introduced in
jdk5.0 which are  different from or not there in jdk1.4.2

How has the programming coding style changed in jdk5.0?

for example if i have a peice of code using arraylist like this
ArrayList myList = null;
myList = databseAdapter.findBySearch(user, criteria); //querying the database and getting results
for (int i=0; i<myList.size(); i++) {
ValueObject price = (ValueObject) myList.get(i);
if(price.getId != null)
formBean.setId(price.getId);
}

How does using jdk5.0 change the above coding convention in any way or is it the same?

if you guys can give any other examples of what is new in jdk 5.0 , that would be great

thanks
J
Comment
Watch Question

Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
well, thanks, but  can you tell me how can we rewrite this peice of below code in jdk5.0

ArrayList myList = null;
myList = databseAdapter.findBySearch(user, criteria); //querying the database and getting results
for (int i=0; i<myList.size(); i++) {
ValueObject price = (ValueObject) myList.get(i);
if(price.getId != null)
formBean.setId(price.getId);
}


how do i rewrite the code/ or make it more simple or efficient  using jdk5.0?

thanks
Look above your post!

Author

Commented:
thnks guys,  has usage of arrays also changed in jdk5.0. for example can you tell me how this peice of code using arrays has changed?

ArrayVO desc[] = new ArrayVO[ids.length];
            for (int i = 0; i < desc.length; i++) {
                  desc[i] = Cache.getInstance().getbyId(mktIds[i]);
}

thanks
CERTIFIED EXPERT
Top Expert 2016
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
ok thanks, can some one tell me the list of things that have changed in jdk5.0 or the new things which have been introduced in jdk5.0? I know Usage of arraylist is one, and what else do we have?

thanks v much
J
But, when retrieving from an array:

for(ArrayVO a: desc)
{
.................. // 'a' accesses every member of the array like above with the ArrayList.
}

;JOOP!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.