~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/juju/utils/deque/doc.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2015 Canonical Ltd.
 
2
// Licensed under the LGPLv3, see LICENCE file for details.
 
3
 
 
4
// The deque package implements an efficient double-ended queue data
 
5
// structure called Deque.
 
6
//
 
7
// Usage:
 
8
//
 
9
//    d := deque.New()
 
10
//    d.PushFront("foo")
 
11
//    d.PushBack("bar")
 
12
//    d.PushBack("123")
 
13
//    l := d.Len()          // l == 3
 
14
//    v, ok := d.PopFront() // v.(string) == "foo", ok == true
 
15
//    v, ok = d.PopFront()  // v.(string) == "bar", ok == true
 
16
//    v, ok = d.PopBack()   // v.(string) == "123", ok == true
 
17
//    v, ok = d.PopBack()   // v == nil, ok == false
 
18
//    v, ok = d.PopFront()  // v == nil, ok == false
 
19
//    l = d.Len()           // l == 0
 
20
//
 
21
// A discussion of the internals can be found at the top of deque.go.
 
22
//
 
23
package deque