ArrayList Methods and Docs
Premium Content - Free Preview
You've already seen ArrayList's
add() method, but ArrayList comes with many other useful methods. You can read about it on the Learneroo ArrayList reference, but to get all the info you should lookup ArrayList on the Official Java 7 API Documentation. The documentation may seem confusing, but it's important to have some idea as to how to use it.
The first step to finding out more about a Library Class is to search for it. If you know the name of the Class, you can use Google, ctrl-F in your browser, or an extension to lookup the class on the official site.
Its useful to be quickly look up the documentation for a method while coding. To do this in BlueJ, press ctrl-space after starting to type the method name. You can also press it after typing the "dot" to pull up a list of all methods in that class. This will let you view documentation and select methods without having to type it all out manually. You can even use this shortcut for classes you create!
Here's an example of using ctrl-space to lookup String documentation:
As mentioned, you can use the Java Library without knowing how the Classes are implemented internally. All you need to know is its external interface:
- A general description of what the class does
- A list of its constructors and methods
- The parameters taken in and the return type of each method and constructor
- The purpose of each method and constructor
All of this information is provided in the official documentation.