Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
b
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
b
Commits
858434e3
Commit
858434e3
authored
Jun 20, 2014
by
Jan Mercl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore First/Last.
parent
2d6fbbb4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
btree.go
btree.go
+18
-18
No files found.
btree.go
View file @
858434e3
...
...
@@ -363,15 +363,15 @@ func (t *Tree) find(q interface{}, k interface{} /*K*/) (i int, ok bool) {
return
l
,
false
}
//
A //
First returns the first item of the tree in the key collating order, or
//
A //
(zero-value, zero-value) if the tree is empty.
//A
func (t *Tree) First() (k interface{} /*K*/, v interface{} /*V*/) {
//A
if q := t.first; q != nil {
//A
q := &q.d[0]
//A
k, v = q.k, q.v
//A
}
//A
return
//A
}
// First returns the first item of the tree in the key collating order, or
// (zero-value, zero-value) if the tree is empty.
func
(
t
*
Tree
)
First
()
(
k
interface
{}
/*K*/
,
v
interface
{}
/*V*/
)
{
if
q
:=
t
.
first
;
q
!=
nil
{
q
:=
&
q
.
d
[
0
]
k
,
v
=
q
.
k
,
q
.
v
}
return
}
// Get returns the value associated with k and true if it exists. Otherwise Get
// returns (zero-value, false).
...
...
@@ -414,15 +414,15 @@ func (t *Tree) insert(q *d, i int, k interface{} /*K*/, v interface{} /*V*/) *d
return
q
}
//
A //
Last returns the last item of the tree in the key collating order, or
//
A //
(zero-value, zero-value) if the tree is empty.
//A
func (t *Tree) Last() (k interface{} /*K*/, v interface{} /*V*/) {
//A
if q := t.last; q != nil {
//A
q := &q.d[q.c-1]
//A
k, v = q.k, q.v
//A
}
//A
return
//A
}
// Last returns the last item of the tree in the key collating order, or
// (zero-value, zero-value) if the tree is empty.
func
(
t
*
Tree
)
Last
()
(
k
interface
{}
/*K*/
,
v
interface
{}
/*V*/
)
{
if
q
:=
t
.
last
;
q
!=
nil
{
q
:=
&
q
.
d
[
q
.
c
-
1
]
k
,
v
=
q
.
k
,
q
.
v
}
return
}
// Len returns the number of items in the tree.
func
(
t
*
Tree
)
Len
()
int
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment