Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

some APIs needed in SCJP 1.5

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Iterator: haveNext(), next(), remove();

JavaBeans naming standards: set, get, is

StringBuffer:
charAt(i)
setCharAt(i)
append(prim), append(char[]), append(Object)
insert(offset, ...)
deleteCharAt(i)
delete(start, end)
reverse()
setLength(i)
insureCapacity(i)
capacity()

Appropriate use of assertions (not for checking parameters in public methods, conditions that

should always hold).

famous thowables:
ArrayIndexOutOfBounds, ClassCast, NullPointer, IllegalArgument, IllegalState, NumberFormat
Errors: Assertion, StackOverflow, NoClassDefFound, ExceptionInInitializer

Wrappers:
Finals, Immutables
Wrapper(prim);
Wrapper(String);
Wrapper static valueOf(String);
xxx xxxValue();
prim parsePrim();

File:
boolean isFile(), isDirectory(), exists(), canRead(), canWrite()
boolean delete(), renameTo(), mkdir()
String getName(), getParent(), getPath(), getAbsolutePath(),
String[] list(); // it should be a dir

FileReader(File/String): char trio
BufferedReader(Reader): trio + String readLine
BufferedWriter(Reader): pento + newLine();
PrintWriter(InputStream): pento + print + printf + println

FileInputStream(File/String): byte trio
DataInputStream(InputStream): + readPrim + readUTF
ObjectInputStream(InputStream): + readObject

Pattern:
Pattern compile(String)
Matcher matcher()
String[] split(String)

Matcher:
boolean matches(), lookingAt(), find()
int start(), int end(), String group()

Regular expression:
* + ?: A*, AA*, A|epsilon
[] (or): [abc]
. (any_char) \d (digit) \s (space) \w (word = [A-za-z\d_])
() for grouping

Formatter:
Formatter format([Locale,] format string, Object[]);
Appendable out();

Scanner:
XXX nextXXX(), boolean hasNextXXX();

Locale:
Locale("en", "US");
String getISO3Country();
String getISO3Language();
String getDisplayCountry(Locale);
String getDisplaylanguage(Locale);
String getDisplayName(Locale);
static Locale getDefault();
static Locale[] getAvailableLocales();
static setDefault();

java.text:

DateFormat:
DateFormat getDateInstance(int, Locale);
DateFormat getTimeInstance(int, Locale);
DateFormat getDateTimeInstance(int, int, Locale);
DateFormat getInstance()
= getDateTimeInstance(SHORT, SHORT, Locale.getDefault());
int SHORT, FULL;

Date parse(String);
String format(Date());

NumberFormat:
int parse(String);
String format(long), format(double), format(Object)
NumberFormat:getInstance(Locale),
getNumberInstance(Locale), getIntegerInstance(Locale),
getDoubleInstance(Locale), getCurrencyInstance(Locale)


Collection: add, remove, contains
Map: put, get, remove, containKey, containValue
Set: Collection
List: Collection + get, set


List:
sorting: void Collections.sort(List);
binarySearch:int Collections.binarySearch(List);
to arrays:Object[] Collection.toArray();

ِArrays:
sorting:
void Arrays.sort(Object[]);
void Arrays.sort(Object[]);
void Arrays.sort(Prim[]);

binarySearch:
void Arrays.binarySearch(Object[]);
void Arrays.binarySearch(Prim[]);

to list:
List Arrays.toList(Object[]); // a view --> size can't change


java.util.Comparator, java.lang.Comparable to affect the sorting of lists and arrays.
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
wow,what a great job you really do


kaise
SCJP 1.4 89%
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your work.

However, I suggest that it is better to change the title to something like:
Notes/Tips for some APIs in SCJP 1.5.

Nick
 
Bilal Al-Sallakh
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Nicholas Cheung:
Thanks for your work.

However, I suggest that it is better to change the title to something like:
Notes/Tips for some APIs in SCJP 1.5.

Nick



Richtig! You are right Nicholas! I just wanted to share some of my sketchs while I was reviewing the APIs. BTW there are some mistakes: parse in NumberFormat returns Number rather than int.
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bilal, thanks for your notes, a very useful overview for me.
some mistake i found:
Iterator hasNext()
JavaBeans naming standards: setXXX(), getXXXX(), boolean isXXX()
void Arrays.binarySearch(Object[], key);
void Arrays.binarySearch(Prim[], key);

again, thanks for sharing
renaud
 
Bartender
Posts: 3733
39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bilal Al-Sallakh:
to list:
List Arrays.toList(Object[]); // a view --> size can't change




There is no 'toList(...)' method, the correct name is 'asList(...)'

regards,
MZ
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic