Documentation
¶
Index ¶
- type Bools
- func (s *Bools) Append(data ...bool)
- func (s Bools) Cap() int
- func (s Bools) Copy() Bools
- func (s *Bools) Insert(index int, data ...bool)
- func (s Bools) Len() int
- func (s Bools) Less(i, j int) bool
- func (s *Bools) Prepend(data ...bool)
- func (s *Bools) Remove(index, num int) int
- func (s Bools) ReverseSort() Bools
- func (s Bools) Shuffle() Bools
- func (s Bools) Sort() Bools
- func (s Bools) Swap(i, j int)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bools ¶
type Bools []bool
Bools 定义方便操作[]bool的类型
Example ¶
package main
import (
"fmt"
"github.com/recallsong/go-utils/container/slice/bools"
)
func main() {
s := bools.Bools{}
s.Append(false, false)
s.Prepend(true, true, true, false, true)
fmt.Println(s, s.Len())
s1 := s.Copy()
s1.Sort()
fmt.Println(s1, s1.Len())
s2 := s.Copy()
s2.ReverseSort()
fmt.Println(s2, s2.Len())
}
Output: [true true true false true false false] 7 [false false false true true true true] 7 [true true true true false false false] 7
func (Bools) ReverseSort ¶
Click to show internal directories.
Click to hide internal directories.