Container

Container specific operations:

  1. // Returns sorted container''s elements with respect to the passed comparator.
  2. // Does not effect the ordering of elements within the container.
  3. func GetSortedValues(container Container, comparator utils.Comparator) []interface{}

Usage:

  1. package main
  2. import (
  3. "github.com/emirpasic/gods/lists/arraylist"
  4. "github.com/emirpasic/gods/utils"
  5. )
  6. func main() {
  7. list := arraylist.New()
  8. list.Add(2, 1, 3)
  9. values := GetSortedValues(container, utils.StringComparator) // [1, 2, 3]
  10. }