1052}
1053
1054// Max returns the largest item in the tree, or (zeroValue, false) if the tree is empty.
1055func (t *BTreeG[T]) Max() (_ T, _ bool) {1056 return max(t.root)
1057}
1058
1047}
1048
1049// Min returns the smallest item in the tree, or (zeroValue, false) if the tree is empty.
1050func (t *BTreeG[T]) Min() (_ T, _ bool) {1051 return min(t.root)
1052}
1053
1038}
1039
1040// GetAt returns the item with index k. If k < 0 or k >= t.Len(), returns nil.
1041func (t *BTreeG[T]) GetAt(k int) T {1042 if t.root == nil {
1043 var zero T
1044 return zero
1029
1030// GetWithIndex gets the key and its index.
1031// If the key is not in the tree, the the index is the number of items < key.
1032func (t *BTreeG[T]) GetWithIndex(key T) (_ T, _ int) {1033 if t.root == nil {
1034 var zero T
1035 return zero, 0
1020
1021// Get looks for the key item in the tree, returning it. It returns
1022// (zeroValue, false) if unable to find that item.
1023func (t *BTreeG[T]) Get(key T) (_ T, _ bool) {1024 if t.root == nil {
1025 return
1026 }
Methods or fields of struct that have names different only by capitalization could be confusing.
type SomeType struct {
// actual build system to be inferred, based on the `BuildSystem` passed by user
buildSystem string
// name of the build system to use
BuildSystem string
}
type SomeType struct {
// actual build system to be inferred, based on the `BuildSystem` passed by user
internalBuildSystem string
// name of the build system to use
BuildSystem string
}