Skip to content

Instantly share code, notes, and snippets.

@silver-mixer
Created March 17, 2020 10:07
Show Gist options
  • Select an option

  • Save silver-mixer/5c80c8cebe15e66628b9f13d9ffe1788 to your computer and use it in GitHub Desktop.

Select an option

Save silver-mixer/5c80c8cebe15e66628b9f13d9ffe1788 to your computer and use it in GitHub Desktop.
isContains method
public boolean isContains(Object o1, Object... obj){
for(Object o: obj){
if(o1.equals(o))return true;
}
return false;
}
@silver-mixer

Copy link
Copy Markdown
Author

自分用に作成した2つ目以降の引数に1つ目の引数と一致する値があるか判定するメソッドのスニペット。
報告、継承など一切不要。使用、改変含めご自由にどうぞ。

Bukkitプラグインでの使用例)
isContains(event.getClickedBlock().getType(), Material.STONE, Material.WOOD, Material.BEDROCK)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment