Skip to content

Commit

Permalink
Add: xorlist & linux time wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexStocks committed Dec 11, 2020
1 parent 4e3d8d4 commit 9e41344
Show file tree
Hide file tree
Showing 13 changed files with 2,125 additions and 3 deletions.
42 changes: 42 additions & 0 deletions container/xorlist/example_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package gxxorlist

import (
"fmt"
)

func Example() {
// Create a new list and put some numbers in it.
l := New()
e4 := l.PushBack(4)
e1 := l.PushFront(1)
l.InsertBefore(3, e4)
l.InsertAfter(2, e1)

// Iterate through list and print its contents.
for e, p := l.Front(); e != nil; e, p = e.Next(p), e {
fmt.Println(e.Value)
}

// Output:
// 1
// 2
// 3
// 4
}

0 comments on commit 9e41344

Please sign in to comment.