Documentation
¶
Overview ¶
Copyright 2015 mint.zhao.chiu@gmail.com
Licensed under the Apache License, Version 2.0 (the "License"): you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2015 mint.zhao.chiu@gmail.com
Licensed under the Apache License, Version 2.0 (the "License"): you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2015 mint.zhao.chiu@gmail.com
Licensed under the Apache License, Version 2.0 (the "License"): you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2015 mint.zhao.chiu@gmail.com
Licensed under the Apache License, Version 2.0 (the "License"): you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- type ArrayList
- func (list *ArrayList) Add(elements ...interface{})
- func (list *ArrayList) Clear()
- func (list *ArrayList) Clone() *ArrayList
- func (list *ArrayList) Contains(elements ...interface{}) bool
- func (list *ArrayList) Elements() []interface{}
- func (list *ArrayList) Empty() bool
- func (list *ArrayList) Get(idx int) (interface{}, bool)
- func (list *ArrayList) Len() int
- func (list *ArrayList) Less(i, j int) bool
- func (list *ArrayList) Remove(idx int)
- func (list *ArrayList) Sort(comparators ...container.CompareFunction)
- func (list *ArrayList) String() string
- func (list *ArrayList) Swap(i, j int)
- type DoublyLinkedList
- func (list *DoublyLinkedList) Add(values ...interface{})
- func (list *DoublyLinkedList) Append(values ...interface{})
- func (list *DoublyLinkedList) Clear()
- func (list *DoublyLinkedList) Contains(values ...interface{}) bool
- func (list *DoublyLinkedList) Elements() []interface{}
- func (list *DoublyLinkedList) Empty() bool
- func (list *DoublyLinkedList) Get(index int) (interface{}, bool)
- func (list *DoublyLinkedList) Len() int
- func (list *DoublyLinkedList) Less(i, j int) bool
- func (list *DoublyLinkedList) Prepend(values ...interface{})
- func (list *DoublyLinkedList) Remove(index int)
- func (list *DoublyLinkedList) Sort(comparators ...container.CompareFunction)
- func (list *DoublyLinkedList) String() string
- func (list *DoublyLinkedList) Swap(i, j int)
- type ListInterface
- type SinglyLinkedList
- func (list *SinglyLinkedList) Add(values ...interface{})
- func (list *SinglyLinkedList) Append(values ...interface{})
- func (list *SinglyLinkedList) Clear()
- func (list *SinglyLinkedList) Contains(values ...interface{}) bool
- func (list *SinglyLinkedList) Elements() []interface{}
- func (list *SinglyLinkedList) Empty() bool
- func (list *SinglyLinkedList) Get(index int) (interface{}, bool)
- func (list *SinglyLinkedList) Len() int
- func (list *SinglyLinkedList) Less(i, j int) bool
- func (list *SinglyLinkedList) Prepend(values ...interface{})
- func (list *SinglyLinkedList) Remove(index int)
- func (list *SinglyLinkedList) Sort(comparators ...container.CompareFunction)
- func (list *SinglyLinkedList) String() string
- func (list *SinglyLinkedList) Swap(i, j int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArrayList ¶
type ArrayList struct {
// contains filtered or unexported fields
}
func NewArrayList ¶
func NewArrayList() *ArrayList
func (*ArrayList) Add ¶
func (list *ArrayList) Add(elements ...interface{})
append elements at the end of the list
func (*ArrayList) Elements ¶
func (list *ArrayList) Elements() []interface{}
return all the elements in the arraylist
func (*ArrayList) Get ¶
return the element at idx, if get the element, return element and true, otherwise nil, false
func (*ArrayList) Sort ¶
func (list *ArrayList) Sort(comparators ...container.CompareFunction)
sort the elements by comparator
type DoublyLinkedList ¶
type DoublyLinkedList struct {
// contains filtered or unexported fields
}
func NewDoublyLinkedList ¶
func NewDoublyLinkedList() *DoublyLinkedList
func (*DoublyLinkedList) Add ¶
func (list *DoublyLinkedList) Add(values ...interface{})
Appends a value (one or more) at the end of the list (same as Append())
func (*DoublyLinkedList) Append ¶
func (list *DoublyLinkedList) Append(values ...interface{})
Appends a value (one or more) at the end of the list (same as Add())
func (*DoublyLinkedList) Clear ¶
func (list *DoublyLinkedList) Clear()
Removes all elements from the list.
func (*DoublyLinkedList) Contains ¶
func (list *DoublyLinkedList) Contains(values ...interface{}) bool
Check if values (one or more) are present in the set. All values have to be present in the set for the method to return true. Performance time complexity of n^2. Returns true if no arguments are passed at all, i.e. set is always super-set of empty set.
func (*DoublyLinkedList) Elements ¶
func (list *DoublyLinkedList) Elements() []interface{}
Returns all elements in the list.
func (*DoublyLinkedList) Empty ¶
func (list *DoublyLinkedList) Empty() bool
Returns true if list does not contain any elements.
func (*DoublyLinkedList) Get ¶
func (list *DoublyLinkedList) Get(index int) (interface{}, bool)
Returns the element at index. Second return parameter is true if index is within bounds of the array and array is not empty, otherwise false.
func (*DoublyLinkedList) Len ¶
func (list *DoublyLinkedList) Len() int
Returns number of elements within the list.
func (*DoublyLinkedList) Less ¶
func (list *DoublyLinkedList) Less(i, j int) bool
func (*DoublyLinkedList) Prepend ¶
func (list *DoublyLinkedList) Prepend(values ...interface{})
Prepends a values (or more)
func (*DoublyLinkedList) Remove ¶
func (list *DoublyLinkedList) Remove(index int)
Removes one or more elements from the list with the supplied indices.
func (*DoublyLinkedList) Sort ¶
func (list *DoublyLinkedList) Sort(comparators ...container.CompareFunction)
Sorts values
func (*DoublyLinkedList) String ¶
func (list *DoublyLinkedList) String() string
func (*DoublyLinkedList) Swap ¶
func (list *DoublyLinkedList) Swap(i, j int)
Swaps values of two elements at the given indices.
type ListInterface ¶
type ListInterface interface { Get(idx int) (interface{}, bool) Remove(idx int) Add(elements ...interface{}) Sort(comparators ...container.CompareFunction) container.ContainerInterface }
type SinglyLinkedList ¶
type SinglyLinkedList struct {
// contains filtered or unexported fields
}
func NewSinglyLinkedList ¶
func NewSinglyLinkedList() *SinglyLinkedList
func (*SinglyLinkedList) Add ¶
func (list *SinglyLinkedList) Add(values ...interface{})
Appends a value (one or more) at the end of the list (same as Append())
func (*SinglyLinkedList) Append ¶
func (list *SinglyLinkedList) Append(values ...interface{})
Appends a value (one or more) at the end of the list (same as Add())
func (*SinglyLinkedList) Clear ¶
func (list *SinglyLinkedList) Clear()
Removes all elements from the list.
func (*SinglyLinkedList) Contains ¶
func (list *SinglyLinkedList) Contains(values ...interface{}) bool
Check if values (one or more) are present in the set. All values have to be present in the set for the method to return true. Performance time complexity of n^2. Returns true if no arguments are passed at all, i.e. set is always super-set of empty set.
func (*SinglyLinkedList) Elements ¶
func (list *SinglyLinkedList) Elements() []interface{}
Returns all elements in the list.
func (*SinglyLinkedList) Empty ¶
func (list *SinglyLinkedList) Empty() bool
Returns true if list does not contain any elements.
func (*SinglyLinkedList) Get ¶
func (list *SinglyLinkedList) Get(index int) (interface{}, bool)
Returns the element at index. Second return parameter is true if index is within bounds of the array and array is not empty, otherwise false.
func (*SinglyLinkedList) Len ¶
func (list *SinglyLinkedList) Len() int
Returns number of elements within the list.
func (*SinglyLinkedList) Less ¶
func (list *SinglyLinkedList) Less(i, j int) bool
func (*SinglyLinkedList) Prepend ¶
func (list *SinglyLinkedList) Prepend(values ...interface{})
Prepends a values (or more)
func (*SinglyLinkedList) Remove ¶
func (list *SinglyLinkedList) Remove(index int)
Removes one or more elements from the list with the supplied indices.
func (*SinglyLinkedList) Sort ¶
func (list *SinglyLinkedList) Sort(comparators ...container.CompareFunction)
Sorts values (in-place) using timsort.
func (*SinglyLinkedList) String ¶
func (list *SinglyLinkedList) String() string
func (*SinglyLinkedList) Swap ¶
func (list *SinglyLinkedList) Swap(i, j int)
Swaps values of two elements at the given indices.