小编dnl*_*max的帖子

什么是更好的?if..else或多个简单if

谈论java性能..什么更好?if..else或多个简单if

if( condition ) {
  some_code;
  return value;
}
else if( condition ) {
  some_code;
  return value;
}
else if( condition ) {
  some_code;
  return value;
}
else {
  some_code;
  return value;
}
Run Code Online (Sandbox Code Playgroud)

要么

if( condition ) {
  some_code;
  return value;
}

if( condition ) {
  some_code;
  return value;
}

if( condition ) {
  some_code;
  return value;
}

some_code;    
return value;
Run Code Online (Sandbox Code Playgroud)

对你的想法感兴趣

Thnx!

java performance if-statement

6
推荐指数
1
解决办法
7555
查看次数

标签 统计

if-statement ×1

java ×1

performance ×1