import array
# A HashCollection is an array of HashNode[K] indexed by the K hash value
-private abstract class HashCollection[K: Object, N: HashNode[Object]]
- super ArrayCapable[nullable N]
+private abstract class HashCollection[K: Object]
+ type N: HashNode[K]
- private var array: nullable NativeArray[nullable N] = null # Used to store items
- private var capacity: Int = 0 # Size of _array
- private var the_length: Int = 0 # Number of items in the map
+ var array: nullable NativeArray[nullable N] = null # Used to store items
+ var capacity: Int = 0 # Size of _array
+ var the_length: Int = 0 # Number of items in the map
- private var first_item: nullable N = null # First added item (used to visit items in nice order)
- private var last_item: nullable N = null # Last added item (same)
+ var first_item: nullable N = null # First added item (used to visit items in nice order)
+ var last_item: nullable N = null # Last added item (same)
# The last key accessed (used for cache)
- private var last_accessed_key: nullable K = null
+ var last_accessed_key: nullable K = null
# The last node accessed (used for cache)
- private var last_accessed_node: nullable N = null
+ var last_accessed_node: nullable N = null
# Return the index of the key k
fun index_at(k: K): Int
# Native strings are simple C char *
extern class NativeString `{ char* `}
- super StringCapable
# Creates a new NativeString with a capacity of `length`
new(length: Int) is intern
+
+ # Get char at `index`.
fun [](index: Int): Char is intern
+
+ # Set char `item` at index.
fun []=(index: Int, item: Char) is intern
+
+ # Copy `self` to `dest`.
fun copy_to(dest: NativeString, length: Int, from: Int, to: Int) is intern
# Position of the first nul character.
- Runtime error: Cast failed. Expected `E`, got `Bool` (../lib/standard/collection/array.nit:782)
-Runtime error: Cast failed. Expected `E`, got `Bool` (../lib/standard/collection/array.nit:792)
++Runtime error: Cast failed. Expected `E`, got `Bool` (../lib/standard/collection/array.nit:785)
NativeString
N
Nit