for: Counted or for each loop.
for(;;) : infinite loop
for (int i = START; i < END; i++) : loop that executes (END - START) + 1 times
casting: process of converting a value from one data type to another
zero: index of first element of an array
length: property of an array that returns the size
immutable: type of object that cannot be modified; String objects are immutable
length: property of an array that returns the size
toUpperCase: returns a new string with all of the characters in upper case
toLowerCase: returns a new string with all of the characters in lower case
isEmpty: returns true if the length of a string is 0
indexOf: returns the index of the first occurrence of a specified character.
lastIndexOf: Returns the index of the last occurrence of a specified character
replace: returns a new string resulting from replacing all occurrences of a character with another one
startsWith: returns true if the string starts with a specified prefix
endsWith: returns true if the string ends with a specified suffix
substring: returns a new string that is a substring of this string
trim: returns a new string with leading and trailing whitespace removed
equals: returns true if this string is equals to the passed string as argument
equalsIgnoreCase: returns true if this string is equals to the passed string as argument, ignoring case considerations
compareTo: compares two strings lexicographically
charAt: returns the char value at a specified index
Key: A unique identifier used to represent an element. It is an input value used by the hash function to determine the index in the hash table or hash map.
Value: The data associated with a key in a hash map.
Hashing: A technique used for performing insertions, deletions, and searches in constant average time. Specifically speaking, given the key of an element, the hashing determines the location of the element within the collection (or the index into the array that stores elements).
Hash Function (also called Hashing Function or Mapping Function): A function that takes the key of an element as input and returns a fixed-size value known as a hash code or hash value. The primary purpose of a hash function is to efficiently map data of arbitrary size to fixed-size values, which are used as indexes in hash tables or hash maps.
Perfect Hash Function (also called Direct Hash Function): A hash function that maps each element to a unique position in the collection.
Hash Table: A data structure that uses a hash function to compute the index of a data element based on its key, allowing for quick access, storage, searching, insertion, and deletion.
Hash Map: A data structure used to store key-value pairs for efficient retrieval. A value stored in a hash map is retrieved using a hash function on the given key to calculate an index into an array of buckets, where the desired value can be found. Simply put, it’s like a real-world dictionary where you know the 'word' (key) and can quickly find its 'meaning' (value).
Collision: Occurs when multiple keys hash to the same index generated by a hash function.
Linear Probing (also called Close Addressing) Hashing: A method for resolving hash collisions by sequentially searching for the next available slot until an open one is found.
Unit Testing: The process where you test the smallest functional unit of code.
JUnit: A widely-used framework for writing and running unit tests in Java. It provides annotations and methods to support the creation of test cases and the validation of code behavior.
Assertion: A statement that verifies the expected outcome of a function. Examples include assertEquals
, assertTrue
, and assertNotNull
.
Annotation: Metadata used to define the behavior of test methods and classes. Common JUnit annotations include @Test
, @Before
, @After
, @BeforeClass
, and @AfterClass
.
Exception Testing: Testing to ensure that code correctly handles and throws exceptions when expected. In JUnit, this can be done using the @Test(expected = Exception.class)
annotation or by asserting exceptions programmatically.
Test Class: A class that contains test methods.