1
0
mirror of https://github.com/tursom/GoCollections.git synced 2025-04-27 05:50:27 +08:00

Merge remote-tracking branch 'origin/master' into master

# Conflicts:
#	main.go
This commit is contained in:
tursom 2021-07-05 20:50:09 +08:00
commit 046584afc6
5 changed files with 32 additions and 3 deletions

BIN
GoCollections Normal file

Binary file not shown.

View File

@ -29,7 +29,10 @@ func Loop(iterable Iterable, f func(element interface{}) exceptions.Exception) e
return LoopIterator(iterable.Iterator(), f)
}
func LoopMutable(iterable MutableIterable, f func(element interface{}, iterator MutableIterator) (err exceptions.Exception)) exceptions.Exception {
func LoopMutable(
iterable MutableIterable,
f func(element interface{}, iterator MutableIterator) (err exceptions.Exception),
) exceptions.Exception {
if f == nil || iterable == nil {
return exceptions.NewNPE("", true)
}
@ -53,7 +56,10 @@ func LoopIterator(iterator Iterator, f func(element interface{}) exceptions.Exce
return nil
}
func LoopMutableIterator(iterator MutableIterator, f func(element interface{}, iterator MutableIterator) (err exceptions.Exception)) exceptions.Exception {
func LoopMutableIterator(
iterator MutableIterator,
f func(element interface{}, iterator MutableIterator) (err exceptions.Exception),
) exceptions.Exception {
if f == nil || iterator == nil {
return exceptions.NewNPE("", true)
}

View File

@ -6,7 +6,7 @@ type Queue interface {
// Iterator MutableIterable
Iterator() Iterator
// MutableIterator MutableIterable
MutableIterator() MutableIterator
MutableIterator() *linkedListIterator
Push(element interface{}) exceptions.Exception
Offer() (interface{}, exceptions.Exception)

View File

@ -106,3 +106,23 @@ func PackageAny(err interface{}) Exception {
return NewRuntimeException(err, "", true, nil)
}
}
func PackagePanic(panic interface{}) Exception {
if panic == nil {
return nil
}
switch panic.(type) {
case error:
return NewRuntimeException(
panic,
"an panic caused on handle WebSocket message:",
true, panic,
)
default:
return NewRuntimeException(
panic,
"an panic caused on handle WebSocket message:",
true, nil,
)
}
}

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module github.com/tursom/GoCollections
go 1.17