Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #1021889 // isPrimitiveInstance

JavaX fragment (include)

static boolean isPrimitiveInstance(Class type, O arg) {
  if (type == boolean.class) return arg instanceof Boolean;
  if (type == int.class) return arg instanceof Integer;
  if (type == long.class) return arg instanceof Long;
  if (type == float.class) return arg instanceof Float;
  if (type == short.class) return arg instanceof Short;
  if (type == char.class) return arg instanceof Character;
  if (type == byte.class) return arg instanceof Byte;
  if (type == double.class) return arg instanceof Double;
  false;
}

Author comment

Began life as a copy of #1000961

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021889
Snippet name: isPrimitiveInstance
Eternal ID of this version: #1021889/1
Text MD5: c5e23ee32a67d987d18b3ddf09f8080c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-02 23:40:52
Source code size: 529 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 185 / 213
Referenced in: [show references]