update study with List.set, compareTo and access priviledge sections (need more)

This commit is contained in:
Xevion
2020-03-02 22:22:44 -06:00
parent cef0413621
commit c70d7e401c

View File

@@ -40,6 +40,9 @@ If you find something incorrect, feel free to contribute and modify.
- [char And int Are Interchangeable](#char-and-int-are-interchangeable)
- [Classes Call From Where They Originate](#classes-call-from-where-they-originate)
- [List.remove() Element Shifting](#listremove-element-shifting)
- [List.set() requires a element to work](#listset-requires-a-element-to-work)
- [How .compareTo Functions](#how-compareto-functions)
- [Access Privileges](#access-privileges)
<!-- /TOC -->
@@ -473,4 +476,18 @@ public static void clearInteger(ArrayList<Integer> arr) {
if(arr.get(i) % 2 == 0)
arr.remove(i--);
}
```
```
### List.set() requires a element to work
Lists will not dynamically resize to accommodate the `.set()` method, i.e. to use set at a specified index, the index must be a *valid* position in that array to access using `.get(int i)` or `.remove(int i)`.
### How .compareTo Functions
I've personally been doing `String.compareTo(String other)` incorrectly for a little too long. Here is how it works:
For each character in the array, compare for equality until one does not match. If
### Access Privileges
`public`, `protected` and `private` are the three possible