For two arrays, if one is a prefix, then it is lower.
var a12 = new ArrayCmp[nullable Int].with_items(1,2)
var a123 = new ArrayCmp[nullable Int].with_items(1,2,3)
assert a12 < a123Otherwise, the first element just after the longest common prefix gives the order between the two arrays.
var a124 = new ArrayCmp[nullable Int].with_items(1,2,4)
var a13 = new ArrayCmp[nullable Int].with_items(1,3)
assert a12  < a123
assert a123 < a13Obviously, two equal arrays are equal.
var b12 = new ArrayCmp[nullable Int].with_items(1,2)
assert (a12 <=> b12) == 0null is considered lower than any other elements.
But is still greater than no element.
var a12n = new ArrayCmp[nullable Int].with_items(1,2,null)
assert a12n < a123
assert a12  < a12ncore :: ArrayCmp :: defaultinit
core :: Collection :: CONCURRENT
Type of the concurrent variant of this collectionserialization :: Serializable :: accept_json_serializer
Refinable service to customize the serialization of this class to JSONserialization :: Serializable :: accept_msgpack_attribute_counter
Hook to customize the behavior of theAttributeCounter
			serialization :: Serializable :: accept_msgpack_serializer
Hook to customize the serialization of this class to MessagePackserialization :: Serializable :: add_to_bundle
Called by[]= to dynamically choose the appropriate method according
			core :: Object :: class_factory
Implementation used byget_class to create the specific class.
			core :: Collection :: combinations
Allr-length combinations on self (in same order) without repeated elements.
			core :: Collection :: combinations_with_replacement
Allr-length combination on self (in same order) with repeated elements.
			core :: AbstractArrayRead :: copy_to
Copy a portion ofself to an other array.
			serialization :: Serializable :: core_serialize_to
Actual serialization ofself to serializer
			core :: AbstractArrayRead :: defaultinit
core :: AbstractArray :: defaultinit
core :: Array :: defaultinit
core :: SequenceRead :: defaultinit
core :: ArrayCmp :: defaultinit
core :: SimpleCollection :: defaultinit
core :: Object :: defaultinit
core :: Comparable :: defaultinit
core :: Cloneable :: defaultinit
core :: Collection :: defaultinit
core :: Sequence :: defaultinit
core :: AbstractArray :: enlarge
Force the capacity to be at leastcap.
			core :: Array :: filled_with
Create an array ofcount elements
			serialization :: Serializable :: from_deserializer
Create an instance of this class from thedeserializer
			core :: SequenceRead :: get_or_default
Try to get an element, returndefault if the index is invalid.
			core :: SequenceRead :: get_or_null
Try to get an element, returnnull if the index is invalid.
			core :: Collection :: has_all
Does the collection contain at least each element ofother?
			core :: Collection :: has_any
Does the collection contain at least one element ofother?
			core :: Collection :: has_exactly
Does the collection contain exactly all the elements ofother?
			core :: SequenceRead :: index_of_from
The index of the first occurrence ofitem, starting from pos.
			core :: Sequence :: insert_all
Insert all elements at a given position, following elements are shifted.core :: Object :: is_same_instance
Return true ifself and other are the same instance (i.e. same identity).
			core :: Object :: is_same_serialized
Isself the same as other in a serialization context?
			core :: Object :: is_same_type
Return true ifself and other have the same dynamic type.
			core :: SequenceRead :: iterator_from
Gets a new Iterator starting at positionpos
			core :: SequenceRead :: last_index_of
The index of the last occurrence ofitem.
			core :: SequenceRead :: last_index_of_from
The index of the last occurrence ofitem starting from pos and decrementing.
			core :: AbstractArrayRead :: length=
core :: SequenceRead :: modulo_index
Returns the real index for a modulo index.serialization :: Serializable :: msgpack_extra_array_items
Hook to request a larger than usual metadata arraycore :: Object :: output_class_name
Display class name on stdout (debug only).core :: Collection :: permutations
Allr-length permutations on self (all possible ordering) without repeated elements.
			core :: Collection :: product
Cartesian product, overr times self.
			core :: RemovableCollection :: remove
Remove an occurrence ofitem
			core :: RemovableCollection :: remove_all
Remove all occurrences ofitem
			core :: SequenceRead :: reverse_iterator
Gets an iterator starting at the end and going backwardscore :: SequenceRead :: reverse_iterator_from
Gets an iterator on the chars of self starting frompos
			serialization :: Serializable :: serialize_msgpack
Serializeself to MessagePack bytes
			serialization :: Serializable :: serialize_to
Serializeself to serializer
			serialization :: Serializable :: serialize_to_json
Serializeself to JSON
			core :: Collection :: to_concurrent
Wrapsself in a thread-safe collection
			core :: Collection :: to_counter
Create and fill up a counter with the elements of `self.core :: Collection :: to_curlslist
Convert Collection[String] to CURLSListserialization :: Serializable :: to_pretty_json
Serializeself to plain pretty JSON
			core :: Collection :: to_shuffle
Return a new array made of elements in a random order.core :: Array :: with_capacity
Create an empty array with a given capacity.core :: Array :: with_native
Create a array filled with a given native array.Serializer::serialize
			
# Comparable array for comparable elements.
#
# For two arrays, if one is a prefix, then it is lower.
#
# ~~~
# var a12 = new ArrayCmp[nullable Int].with_items(1,2)
# var a123 = new ArrayCmp[nullable Int].with_items(1,2,3)
# assert a12 < a123
# ~~~
#
# Otherwise, the first element just after the longest
# common prefix gives the order between the two arrays.
#
# ~~~
# var a124 = new ArrayCmp[nullable Int].with_items(1,2,4)
# var a13 = new ArrayCmp[nullable Int].with_items(1,3)
# assert a12  < a123
# assert a123 < a13
# ~~~
#
# Obviously, two equal arrays are equal.
#
# ~~~
# var b12 = new ArrayCmp[nullable Int].with_items(1,2)
# assert (a12 <=> b12) == 0
# ~~~
#
# `null` is considered lower than any other elements.
# But is still greater than no element.
#
# ~~~
# var a12n = new ArrayCmp[nullable Int].with_items(1,2,null)
# assert a12n < a123
# assert a12  < a12n
# ~~~
class ArrayCmp[E: nullable Comparable]
	super Array[E]
	super Comparable
	redef type OTHER: ArrayCmp[E] is fixed
	redef fun <(o) do return (self <=> o) < 0
	redef fun <=>(o)
	do
		var i = 0
		var l = length
		if l == 0 then return 0
		var it = _items.as(not null)
		var oit = o._items.as(not null)
		var ol = o.length
		var len
		if l < ol then len = l else len = ol
		while i < len do
			var a = it[i]
			var b = oit[i]
			if a != null then
				if b == null then return 1
				var d = a <=> b
				if d != 0 then return d
			else
				if b != null then return -1
			end
			i += 1
		end
		return l <=> ol
	end
end
					lib/core/collection/array.nit:881,1--947,3