-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* more sections * First feedback round * Update prelude.md * ... * Spelling fix Co-Authored-By: Firas Regaieg <[email protected]> * Arguments chapter * More Challenges * Run prettier * user input * October 14th, #1 * Array challenges * Delete challenges * Null * ... * Update null_as_absence.md * Delete out.json * Fix quotes * Add first no_runs * Fix number example * ... * Write more of the classes section * Constructors * Clean up getting started a little * Use a duke * Don't link anywhere yet * Increase lines needed to show a duke * Fix field access section * ... * ... * ... * ... * ... * switch and enums * Update book.toml * Density * Update audience.md * .. * Strings 2 * Update length.md * Global Fields * Input * Update delayed_assignment.md * ... * ... * Update book.js * Update challenges.md * Remove blank Challenge * Fix some issues, push some incomplete sections * Update challenges.md * terminal * Update challenges.md * Switches and visibility * Growable array * Cli Args * Delete unused * Change url * inner classes * Update unchecked_exceptions.md * Update checked_exceptions.md * Update invariants.md * Packages * Records * Update the_default_package.md * Syntax highlighting wierdness * More records * Integers, Files, etc. * Move IOException around * ... * ... * Add new dukes and start hash maps * Start hashmap explanation * Objects * Update README.md * More object chapters * More hash maps * More hash maps * new section headers * Time types * ArrayList * For each loops * recursion * Arraylist recursion and switch * Switch progress --------- Co-authored-by: Firas Regaieg <[email protected]>
- Loading branch information
Showing
75 changed files
with
1,524 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,21 +3,20 @@ name: Linter | |
on: [pull_request] | ||
|
||
jobs: | ||
markdown-linter: | ||
name: "Markdown Linter" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# markdown-linter: | ||
# name: "Markdown Linter" | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - name: markdownlint-cli | ||
# uses: nosborn/[email protected] | ||
# with: | ||
# files: . | ||
# config_file: .markdownlint.yaml | ||
|
||
- name: markdownlint-cli | ||
uses: nosborn/[email protected] | ||
with: | ||
files: . | ||
config_file: .markdownlint.yaml | ||
|
||
markdown-link-check: | ||
name: "Markdown Link Checker" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: gaurav-nelson/[email protected] | ||
# markdown-link-check: | ||
# name: "Markdown Link Checker" | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - uses: gaurav-nelson/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Abstract Classes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# ArrayList | ||
|
||
Java comes with a generic growable array. It is called | ||
an `ArrayList`. | ||
|
||
```java | ||
import java.util.ArrayList; | ||
|
||
void main() { | ||
ArrayList<String> names = new ArrayList<>(); | ||
names.add("John Wick"); | ||
|
||
System.out.println(names); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Add an item | ||
|
||
To add an item to an `ArrayList` you use the `.add` | ||
method. | ||
|
||
```java | ||
import java.util.ArrayList; | ||
|
||
void main() { | ||
ArrayList<String> names = new ArrayList<>(); | ||
names.add("The Bowery King"); | ||
names.add("Caine"); | ||
|
||
System.out.println(names); | ||
} | ||
``` | ||
|
||
The way this works is conceptually the | ||
same as the growable array that we went over earlier. | ||
|
||
All you need to know though is that you can add | ||
as many items as you will and the container will grow | ||
dynamically. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Get an item | ||
|
||
To get an item at a given index in an `ArrayList` | ||
you should use `.get` | ||
|
||
```java | ||
import java.util.ArrayList; | ||
|
||
void main() { | ||
ArrayList<String> names = new ArrayList<>(); | ||
names.add("Winston Scott"); | ||
|
||
String name = names.get(0); | ||
System.out.println(name); | ||
} | ||
``` | ||
|
||
If the index you picked is greater than the number of elements in the `ArrayList` | ||
it will throw an `IndexOutOfBoundsException` | ||
|
||
```java,panics | ||
import java.util.ArrayList; | ||
void main() { | ||
ArrayList<String> names = new ArrayList<>(); | ||
names.add("Killa Harkan"); | ||
String name = names.get(10); | ||
System.out.println(name); | ||
} | ||
``` |
Oops, something went wrong.