Thread Rating:
  • 390 Vote(s) - 2.76 Average
  • 1
  • 2
  • 3
  • 4
  • 5
type-switch で Array-of 、HashTable-of を判別したい
12-28-2012, 01:39 PM,
#3
RE: type-switch で Array-of 、HashTable-of を判別したい
type-switch lets you check the type of something and bind a local variable to the type, so you use type-switch to check for each specific type, and write specific code for Array-of int or Array-of String.

It is possible to write the code that looks at the type of the parameters in a ParameterizedType, so you can use type-of to get the type of your object, and then do type-switch on that Type to see if it is a ParameterizedType and then look at ParameterizedType.positional-type-parameters and ParameterizedType .keyword-type-parameters. But if you do not cast the object to a specific type then you will still be doing "any" operations, which are slow, but if that is OK for your use then you can use that technique to write more generic code.


Messages In This Thread
RE: type-switch で Array-of 、HashTable-of を判別したい - by wbardwell - 12-28-2012, 01:39 PM

Possibly Related Threads...
Thread Author Replies Views Last Post
  Array-of が CDEで認識されない? umemura 1 2,494 04-04-2014, 06:28 PM
Last Post: twada
  #t , any , Type の違いは? umemura 3 3,773 09-17-2013, 08:05 PM
Last Post: umemura
  Array-of とSet-of の違い yosmas 2 4,003 08-18-2011, 05:09 PM
Last Post: yosmas
Forum Jump:


Users browsing this thread:
2 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('680')