Table of Contents

Class JavaUtilExtensions

Namespace
MASES.JNet.Specific.Extensions
Assembly
MASES.JNet.dll

Extension for Java.Util classes

public static class JavaUtilExtensions
Inheritance
JavaUtilExtensions
Inherited Members

Methods

ToJVMArray<TJVMType, TNetType>(TNetType[], Func<TNetType, TJVMType>)

Converts an IEnumerable<T> of string to an array of String

public static TJVMType[] ToJVMArray<TJVMType, TNetType>(this TNetType[] collection, Func<TNetType, TJVMType> func = null) where TJVMType : INativeConvertible<TJVMType, TNetType>, new()

Parameters

collection TNetType[]

The array of TNetType to be converted

func Func<TNetType, TJVMType>

An optional Func<T, TResult> used to return TJVMType from data of TNetType in collection

Returns

TJVMType[]

The array of TJVMType

Type Parameters

TJVMType
TNetType

ToJVMCollectionType<TIterableType, TJVMTypeInner, TNetType>(IEnumerable<TNetType>, Func<TNetType, TJVMTypeInner>)

Converts an IEnumerable<T> of TNetType to an TIterableType of TJVMTypeInner

public static TIterableType ToJVMCollectionType<TIterableType, TJVMTypeInner, TNetType>(this IEnumerable<TNetType> set, Func<TNetType, TJVMTypeInner> func = null) where TIterableType : Collection<TJVMTypeInner>, new() where TJVMTypeInner : INativeConvertible<TJVMTypeInner, TNetType>, new()

Parameters

set IEnumerable<TNetType>

The Collection<E> of TJVMTypeInner to be converted

func Func<TNetType, TJVMTypeInner>

An optional Func<T, TResult> used to return TJVMTypeInner from data of TNetType in set

Returns

TIterableType

The converted TIterableType of TJVMTypeInner

Type Parameters

TIterableType

A type implementing Iterable<T>

TJVMTypeInner

The expected JVM type

TNetType

The original .NET type

ToJVMCollection<TJVMType, TNetType>(IEnumerable<TNetType>, Func<TNetType, TJVMType>)

Converts an IEnumerable<T> of string to an Collection<E> of String

public static Collection<TJVMType> ToJVMCollection<TJVMType, TNetType>(this IEnumerable<TNetType> set, Func<TNetType, TJVMType> func = null) where TJVMType : INativeConvertible<TJVMType, TNetType>, new()

Parameters

set IEnumerable<TNetType>

The IEnumerable<T> of string to be converted

func Func<TNetType, TJVMType>

An optional Func<T, TResult> used to return TJVMType from data of TNetType in set

Returns

Collection<TJVMType>

The converted Collection<E> of String

Type Parameters

TJVMType
TNetType

ToJVMDictionary<TJVMK, TJVMV, K, V>(IDictionary<K, V>, Func<K, TJVMK>, Func<V, TJVMV>)

public static Dictionary<TJVMK, TJVMV> ToJVMDictionary<TJVMK, TJVMV, K, V>(this IDictionary<K, V> dictionary, Func<K, TJVMK> keyConverter, Func<V, TJVMV> valueConverter)

Parameters

dictionary IDictionary<K, V>

The IDictionary<TKey, TValue>

keyConverter Func<K, TJVMK>

Converter from K to TJVMK

valueConverter Func<V, TJVMV>

Converter from V to TJVMV

Returns

Dictionary<TJVMK, TJVMV>

The Dictionary<K, V>

Type Parameters

TJVMK

JVM key type

TJVMV

JVM value type

K

.NET Key type

V

.NET Value

ToJVMDictionary<TDictionaryType, TJVMK, TJVMV, K, V>(IDictionary<K, V>, Func<K, TJVMK>, Func<V, TJVMV>)

Converts a IDictionary<TKey, TValue> to TDictionaryType

public static TDictionaryType ToJVMDictionary<TDictionaryType, TJVMK, TJVMV, K, V>(this IDictionary<K, V> dictionary, Func<K, TJVMK> keyConverter = null, Func<V, TJVMV> valueConverter = null) where TDictionaryType : Dictionary<TJVMK, TJVMV>, new() where TJVMK : INativeConvertible<TJVMK, K> where TJVMV : INativeConvertible<TJVMV, V>

Parameters

dictionary IDictionary<K, V>

The IDictionary<TKey, TValue>

keyConverter Func<K, TJVMK>

Optional converter from K to TJVMK

valueConverter Func<V, TJVMV>

Optional converter from V to TJVMV

Returns

TDictionaryType

The TDictionaryType

Type Parameters

TDictionaryType

The Dictionary<K, V> over TJVMK and TJVMV

TJVMK

JVM key type

TJVMV

JVM value type

K

.NET Key type

V

.NET Value

ToJVMMap<TJVMK, TJVMV, K, V>(IDictionary<K, V>, Func<K, TJVMK>, Func<V, TJVMV>)

public static Map<TJVMK, TJVMV> ToJVMMap<TJVMK, TJVMV, K, V>(this IDictionary<K, V> dictionary, Func<K, TJVMK> keyConverter, Func<V, TJVMV> valueConverter)

Parameters

dictionary IDictionary<K, V>

The IDictionary<TKey, TValue>

keyConverter Func<K, TJVMK>

Converter from K to TJVMK

valueConverter Func<V, TJVMV>

Converter from V to TJVMV

Returns

Map<TJVMK, TJVMV>

The Map<K, V>

Type Parameters

TJVMK

JVM key type

TJVMV

JVM value type

K

.NET Key type

V

.NET Value

ToJVMMap<TMapType, TJVMK, TJVMV, K, V>(IDictionary<K, V>, Func<K, TJVMK>, Func<V, TJVMV>)

Converts a IDictionary<TKey, TValue> to TMapType

public static TMapType ToJVMMap<TMapType, TJVMK, TJVMV, K, V>(this IDictionary<K, V> dictionary, Func<K, TJVMK> keyConverter = null, Func<V, TJVMV> valueConverter = null) where TMapType : Map<TJVMK, TJVMV>, new() where TJVMK : INativeConvertible<TJVMK, K> where TJVMV : INativeConvertible<TJVMV, V>

Parameters

dictionary IDictionary<K, V>

The IDictionary<TKey, TValue>

keyConverter Func<K, TJVMK>

Optional converter from K to TJVMK

valueConverter Func<V, TJVMV>

Optional converter from V to TJVMV

Returns

TMapType

The TMapType

Type Parameters

TMapType

The Map<K, V> over TJVMK and TJVMV

TJVMK

JVM key type

TJVMV

JVM value type

K

.NET Key type

V

.NET Value

ToNetArray<TNetType, TJVMType>(IEnumerable<TJVMType>)

Converts an IEnumerable<T> of String to an array of string

public static TNetType[] ToNetArray<TNetType, TJVMType>(this IEnumerable<TJVMType> set) where TJVMType : INativeConvertible<TJVMType, TNetType>

Parameters

set IEnumerable<TJVMType>

The IEnumerable<T> of String to be converted

Returns

TNetType[]

The converted array of string

Type Parameters

TNetType
TJVMType

ToNetCollectionType<TEnumerableType, TNetTypeInner, TJVMType>(IEnumerable<TJVMType>, Func<TJVMType, TNetTypeInner>)

Converts an IEnumerable<T> of TJVMType to an TEnumerableType of TNetTypeInner

public static TEnumerableType ToNetCollectionType<TEnumerableType, TNetTypeInner, TJVMType>(this IEnumerable<TJVMType> set, Func<TJVMType, TNetTypeInner> func = null) where TEnumerableType : ICollection<TNetTypeInner>, new() where TJVMType : INativeConvertible<TJVMType, TNetTypeInner>

Parameters

set IEnumerable<TJVMType>

The IEnumerable<T> of TJVMType to be converted

func Func<TJVMType, TNetTypeInner>

An Func<T, TResult> used to convert TJVMType into TNetTypeInner

Returns

TEnumerableType

The converted TEnumerableType of TNetTypeInner

Type Parameters

TEnumerableType

A type implementing IEnumerable<T>

TNetTypeInner

The expected .NET type

TJVMType

The original JVM type

ToNetDictiony<K, V, TJVMK, TJVMV>(Map<TJVMK, TJVMV>, Func<TJVMK, K>, Func<TJVMV, V>)

public static IDictionary<K, V> ToNetDictiony<K, V, TJVMK, TJVMV>(this Map<TJVMK, TJVMV> map, Func<TJVMK, K> keyConverter = null, Func<TJVMV, V> valueConverter = null) where TJVMK : INativeConvertible<TJVMK, K> where TJVMV : INativeConvertible<TJVMV, V>

Parameters

map Map<TJVMK, TJVMV>

The Map<K, V>

keyConverter Func<TJVMK, K>

Optional converter from TJVMK to K

valueConverter Func<TJVMV, V>

Optional converter from TJVMV to V

Returns

IDictionary<K, V>

The IDictionary<TKey, TValue>

Type Parameters

K

.NET Key type

V

.NET Value

TJVMK

JVM key type

TJVMV

JVM value type

ToNetDictiony<TDictionaryType, K, V, TJVMK, TJVMV>(Map<TJVMK, TJVMV>, Func<TJVMK, K>, Func<TJVMV, V>)

public static TDictionaryType ToNetDictiony<TDictionaryType, K, V, TJVMK, TJVMV>(this Map<TJVMK, TJVMV> map, Func<TJVMK, K> keyConverter = null, Func<TJVMV, V> valueConverter = null) where TDictionaryType : IDictionary<K, V>, new() where TJVMK : INativeConvertible<TJVMK, K> where TJVMV : INativeConvertible<TJVMV, V>

Parameters

map Map<TJVMK, TJVMV>

The Map<K, V>

keyConverter Func<TJVMK, K>

Optional converter from TJVMK to K

valueConverter Func<TJVMV, V>

Optional converter from TJVMV to V

Returns

TDictionaryType

The IDictionary<TKey, TValue>

Type Parameters

TDictionaryType

The IDictionary<TKey, TValue> over K and V

K

.NET Key type

V

.NET Value

TJVMK

JVM key type

TJVMV

JVM value type