Documentation
¶
Overview ¶
Copyright 2015 mint.zhao.chiu@gmail.com
Licensed 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.
Copyright 2015 mint.zhao.chiu@gmail.com
Licensed 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.
Copyright 2015 mint.zhao.chiu@gmail.com
Licensed 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.
Index ¶
- type ArrayStack
- func (stack *ArrayStack) Clear()
- func (stack *ArrayStack) Contains(elements ...interface{}) bool
- func (stack *ArrayStack) Elements() []interface{}
- func (stack *ArrayStack) Empty() bool
- func (stack *ArrayStack) Len() int
- func (stack *ArrayStack) Peek() (value interface{}, ok bool)
- func (stack *ArrayStack) Pop() (value interface{}, ok bool)
- func (stack *ArrayStack) Push(value interface{})
- func (stack *ArrayStack) String() string
- type LinkedListStack
- func (stack *LinkedListStack) Clear()
- func (stack *LinkedListStack) Contains(elements ...interface{}) bool
- func (stack *LinkedListStack) Elements() []interface{}
- func (stack *LinkedListStack) Empty() bool
- func (stack *LinkedListStack) Len() int
- func (stack *LinkedListStack) Peek() (value interface{}, ok bool)
- func (stack *LinkedListStack) Pop() (value interface{}, ok bool)
- func (stack *LinkedListStack) Push(value interface{})
- func (stack *LinkedListStack) String() string
- type StackInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArrayStack ¶
type ArrayStack struct {
// contains filtered or unexported fields
}
func NewArrayStack ¶
func NewArrayStack() *ArrayStack
func (*ArrayStack) Contains ¶
func (stack *ArrayStack) Contains(elements ...interface{}) bool
not important, just for interface{}
func (*ArrayStack) Elements ¶
func (stack *ArrayStack) Elements() []interface{}
Returns all elements in the stack (LIFO order).
func (*ArrayStack) Empty ¶
func (stack *ArrayStack) Empty() bool
Returns true if stack does not contain any elements.
func (*ArrayStack) Len ¶
func (stack *ArrayStack) Len() int
Returns number of elements within the stack.
func (*ArrayStack) Peek ¶
func (stack *ArrayStack) Peek() (value interface{}, ok bool)
Returns top element on the stack without removing it, or nil if stack is empty. Second return parameter is true, unless the stack was empty and there was nothing to peek.
func (*ArrayStack) Pop ¶
func (stack *ArrayStack) Pop() (value interface{}, ok bool)
Pops (removes) top element on stack and returns it, or nil if stack is empty. Second return parameter is true, unless the stack was empty and there was nothing to pop.
func (*ArrayStack) Push ¶
func (stack *ArrayStack) Push(value interface{})
Pushes a value onto the top of the stack
func (*ArrayStack) String ¶
func (stack *ArrayStack) String() string
type LinkedListStack ¶
type LinkedListStack struct {
// contains filtered or unexported fields
}
func (*LinkedListStack) Clear ¶
func (stack *LinkedListStack) Clear()
Removes all elements from the stack.
func (*LinkedListStack) Contains ¶
func (stack *LinkedListStack) Contains(elements ...interface{}) bool
not important, just for interface{}
func (*LinkedListStack) Elements ¶
func (stack *LinkedListStack) Elements() []interface{}
Returns all elements in the stack (LIFO order).
func (*LinkedListStack) Empty ¶
func (stack *LinkedListStack) Empty() bool
Returns true if stack does not contain any elements.
func (*LinkedListStack) Len ¶
func (stack *LinkedListStack) Len() int
Returns number of elements within the stack.
func (*LinkedListStack) Peek ¶
func (stack *LinkedListStack) Peek() (value interface{}, ok bool)
Returns top element on the stack without removing it, or nil if stack is empty. Second return parameter is true, unless the stack was empty and there was nothing to peek.
func (*LinkedListStack) Pop ¶
func (stack *LinkedListStack) Pop() (value interface{}, ok bool)
Pops (removes) top element on stack and returns it, or nil if stack is empty. Second return parameter is true, unless the stack was empty and there was nothing to pop.
func (*LinkedListStack) Push ¶
func (stack *LinkedListStack) Push(value interface{})
Pushes a value onto the top of the stack
func (*LinkedListStack) String ¶
func (stack *LinkedListStack) String() string
type StackInterface ¶
type StackInterface interface { Push(value interface{}) Pop() (value interface{}, ok bool) Peek() (value interface{}, ok bool) container.ContainerInterface }