DOC PREVIEW
Duke CPS 100E - What can you put into an Array List

This preview shows page 1 out of 4 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CompSci 100E5.1What can you put into an ArrayList?ÿ Anything that derives from Object String, ArrayList, Counter, … int, double, char, boolean, …NO!!!ÿ What can we do if want a collection of int values Put an upper bound on the count and use arrayint index = 0;int[] a = new int[HUGE_NUMBER];while (…) {if (condition()){a[index++] = value;}}CompSci 100E5.2What can you put into an ArrayList?ÿ Use a wrapper class (see java.lang.*) int, double, char, boolean, … Integer, Double, Character, Boolean,ArrayList list = new ArrayList();while (…) {if (condition()){list.add(new Integer(value));}}int[]a=newint[list.size()];for(intk=0;k<list.size();k++){a[k] = ( (Integer) list.get(k) ).intValue();}CompSci 100E5.3What is a char?ÿ Differences between unicode and ASCII Why is unicode used? Why should we care? What should we know? How many of the details are important?ÿ A char value can be treated like a 16 bit int value Add integer to it, cast back to char Subtract character from it, get int backcounters[‘z’ - s.charAt(k)]++; Anatomy of the statement above??CompSci 100E5.4Lydia Kavrakiÿ Awards Grace Murray Hopper Brilliant 10"I like to work on problems that will generally improve the quality of our life," What's the thing you love most about science?“Working with students and interacting with people from diverse intellectual backgrounds. Discovery and the challenge of solving a tough problem, especially when it can really affect the quality of our lives. I find the whole process


View Full Document

Duke CPS 100E - What can you put into an Array List

Documents in this Course
Topics

Topics

9 pages

Lecture

Lecture

3 pages

Notes

Notes

2 pages

Hashing

Hashing

19 pages

Lecture

Lecture

59 pages

Lecture

Lecture

6 pages

Lecture

Lecture

4 pages

Lecture

Lecture

20 pages

Lecture

Lecture

12 pages

Lecture

Lecture

12 pages

Lecture

Lecture

7 pages

Lecture

Lecture

8 pages

Lecture

Lecture

10 pages

Lecture

Lecture

4 pages

Notes

Notes

16 pages

Lecture

Lecture

5 pages

Lecture

Lecture

9 pages

Lecture

Lecture

4 pages

Lecture

Lecture

13 pages

Lecture

Lecture

6 pages

Lecture

Lecture

16 pages

Lecture

Lecture

5 pages

Lecture

Lecture

5 pages

Lecture

Lecture

12 pages

Lecture

Lecture

12 pages

Lecture

Lecture

10 pages

Sets

Sets

14 pages

Lecture

Lecture

9 pages

Lecture

Lecture

4 pages

Test 1

Test 1

7 pages

Load more
Download What can you put into an Array List
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view What can you put into an Array List and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view What can you put into an Array List 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?