com.buabook.kdb.Dicts Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-kdb-communication Show documentation
Show all versions of java-kdb-communication Show documentation
Java library to publish data into and query data out of kdb+ processes (c) 2017 Sport Trades Ltd
The newest version!
package com.buabook.kdb;
import com.buabook.kdb.data.KdbDict;
import com.kx.c.Dict;
/**
* {@link Dict} and {@link KdbDict} Helpers
* (c) 2017 Sport Trades Ltd
*
* @author Jas Rajasansir
* @version 1.0.0
* @since 21 Feb 2017
*/
public final class Dicts {
/** @return true
if the specified dictionary is null
or has no data in it; false
otherwise */
public static boolean isNullOrEmpty(KdbDict dict) {
return dict == null || dict.isEmpty();
}
/** @return true
if the specified dictionary is null
or has no data in it; false
otherwise */
public static boolean isNullOrEmpty(Dict dict) {
return getSize(dict) == 0;
}
/** @return The number of elements within the specified dictionary */
public static int getSize(Dict dict) {
if(dict == null)
return 0;
Object[] keys = (Object[]) dict.x;
if(keys == null)
return 0;
return keys.length;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy