Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Java 中实现以下 Python 代码的最简单/有效的方法是什么?
if "foo" in ["foo", "bar"]: print "found."
如果您有数组中的数据,请使用此
String[] strings = {"foo","bar"}; for (String s : strings) { if (s.equals("foo")) { System.out.println("found"); break; } }