本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.3KB

  1. // Copyright (c) 2015, Emir Pasic. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Package lists provides an abstract List interface.
  5. //
  6. // In computer science, a list or sequence is an abstract data type that represents an ordered sequence of values, where the same value may occur more than once. An instance of a list is a computer representation of the mathematical concept of a finite sequence; the (potentially) infinite analog of a list is a stream. Lists are a basic example of containers, as they contain other values. If the same value occurs multiple times, each occurrence is considered a distinct item.
  7. //
  8. // Reference: https://en.wikipedia.org/wiki/List_%28abstract_data_type%29
  9. package lists
  10. import (
  11. "github.com/emirpasic/gods/containers"
  12. "github.com/emirpasic/gods/utils"
  13. )
  14. // List interface that all lists implement
  15. type List interface {
  16. Get(index int) (interface{}, bool)
  17. Remove(index int)
  18. Add(values ...interface{})
  19. Contains(values ...interface{}) bool
  20. Sort(comparator utils.Comparator)
  21. Swap(index1, index2 int)
  22. Insert(index int, values ...interface{})
  23. Set(index int, value interface{})
  24. containers.Container
  25. // Empty() bool
  26. // Size() int
  27. // Clear()
  28. // Values() []interface{}
  29. }
上海开阖软件有限公司 沪ICP备12045867号-1