Copyright (c) 2015, Emir Pasic. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

package utils

import 
Comparator will make type assertion (see IntComparator for example), which will panic if a or b are not of the asserted type. Should return a number: negative , if a < b zero , if a == b positive , if a > b
type Comparator func(a, b interface{}) int
StringComparator provides a fast comparison on strings
func (,  interface{}) int {
	 := .(string)
	 := .(string)
	 := len()
	if len() < len() {
		 = len()
	}
	 := 0
	for  := 0;  <  &&  == 0; ++ {
		 = int([]) - int([])
	}
	if  == 0 {
		 = len() - len()
	}
	if  < 0 {
		return -1
	}
	if  > 0 {
		return 1
	}
	return 0
}
IntComparator provides a basic comparison on int
func (,  interface{}) int {
	 := .(int)
	 := .(int)
	switch {
	case  > :
		return 1
	case  < :
		return -1
	default:
		return 0
	}
}
Int8Comparator provides a basic comparison on int8
func (,  interface{}) int {
	 := .(int8)
	 := .(int8)
	switch {
	case  > :
		return 1
	case  < :
		return -1
	default:
		return 0
	}
}
Int16Comparator provides a basic comparison on int16
func (,  interface{}) int {
	 := .(int16)
	 := .(int16)
	switch {
	case  > :
		return 1
	case  < :
		return -1
	default:
		return 0
	}
}
Int32Comparator provides a basic comparison on int32
func (,  interface{}) int {
	 := .(int32)
	 := .(int32)
	switch {
	case  > :
		return 1
	case  < :
		return -1
	default:
		return 0
	}
}
Int64Comparator provides a basic comparison on int64
func (,  interface{}) int {
	 := .(int64)
	 := .(int64)
	switch {
	case  > :
		return 1
	case  < :
		return -1
	default:
		return 0
	}
}
UIntComparator provides a basic comparison on uint
func (,  interface{}) int {
	 := .(uint)
	 := .(uint)
	switch {
	case  > :
		return 1
	case  < :
		return -1
	default:
		return 0
	}
}
UInt8Comparator provides a basic comparison on uint8
func (,  interface{}) int {
	 := .(uint8)
	 := .(uint8)
	switch {
	case  > :
		return 1
	case  < :
		return -1
	default:
		return 0
	}
}
UInt16Comparator provides a basic comparison on uint16
func (,  interface{}) int {
	 := .(uint16)
	 := .(uint16)
	switch {
	case  > :
		return 1
	case  < :
		return -1
	default:
		return 0
	}
}
UInt32Comparator provides a basic comparison on uint32
func (,  interface{}) int {
	 := .(uint32)
	 := .(uint32)
	switch {
	case  > :
		return 1
	case  < :
		return -1
	default:
		return 0
	}
}
UInt64Comparator provides a basic comparison on uint64
func (,  interface{}) int {
	 := .(uint64)
	 := .(uint64)
	switch {
	case  > :
		return 1
	case  < :
		return -1
	default:
		return 0
	}
}
Float32Comparator provides a basic comparison on float32
func (,  interface{}) int {
	 := .(float32)
	 := .(float32)
	switch {
	case  > :
		return 1
	case  < :
		return -1
	default:
		return 0
	}
}
Float64Comparator provides a basic comparison on float64
func (,  interface{}) int {
	 := .(float64)
	 := .(float64)
	switch {
	case  > :
		return 1
	case  < :
		return -1
	default:
		return 0
	}
}
ByteComparator provides a basic comparison on byte
func (,  interface{}) int {
	 := .(byte)
	 := .(byte)
	switch {
	case  > :
		return 1
	case  < :
		return -1
	default:
		return 0
	}
}
RuneComparator provides a basic comparison on rune
func (,  interface{}) int {
	 := .(rune)
	 := .(rune)
	switch {
	case  > :
		return 1
	case  < :
		return -1
	default:
		return 0
	}
}
TimeComparator provides a basic comparison on time.Time
func (,  interface{}) int {
	 := .(time.Time)
	 := .(time.Time)

	switch {
	case .After():
		return 1
	case .Before():
		return -1
	default:
		return 0
	}