且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检查一组字符串中是否存在字符串?

更新时间:2021-08-26 23:39:21

Andrew Thompson写道:
Andrew Thompson wrote:
2004年3月12日星期五03:05:46 GMT,有人写道:

On Fri, 12 Mar 2004 03:05:46 GMT, someone wrote:

检查一组
字符串中字符串是否存在的最快方法是什么?

HashMap
>
我想过把一组字符串放在一个HashMap然后我们
containsKey()做检查但是我不喜欢因为这是
HashMap的目标。
I have thought of putting the set of strings in a HashMap and then us
containsKey() to do the check but I don''t like because this is the
objective of HashMap.



?!?!那么,你不会想到将Applet类用于Applet,
因为这是Applet的目标吗?


?!?! So, you would not think to
use Applet class for an Applet,
because that is the objective of
Applet?




对不起,我错过了打字。我的意思不是客观因素,因为在我的情况下我不会给键值对,我只有键。

让我想起''飞得很高''
但是没有..等等。这是_exactly_
他们会期待什么。



Sorry, I miss-typed it. I meant NOT the objective because in my case I
don''t key-value pairs, I have only keys.
Reminds me of ''Flying High''
"But no ..wait. That''s _exactly_
what they''ll be expecting."

你还推荐什么?



HashMap,..和发布信息
或有意义的问题。


HashMap, ..and posting information
or questions that makes sense.






有人写道:

抱歉,我错过了打字。我的意思不是客观因素,因为在我的情况下我没有键值对,我只有键。

Sorry, I miss-typed it. I meant NOT the objective because in my case I
don''t key-value pairs, I have only keys.




然后,显然,使用HashSet 。



Then, clearly, use HashSet.


Andrew Thompson写道:
Andrew Thompson wrote:
2004年3月12日星期五03:28:12 GMT,有人写道:

On Fri, 12 Mar 2004 03:28:12 GMT, someone wrote:

Andrew Thompson写道:
Andrew Thompson wrote:
2004年3月12日星期五03:05:46 GMT,有人写道:
..
字符串中字符串是否存在的最快方法是什么?
..
我想过将字符串集放在HashMap中然后我们
containsKey()进行检查,但我不喜欢,因为这是HashMap的目标。
On Fri, 12 Mar 2004 03:05:46 GMT, someone wrote:
..
What is the fastest way to check the existence of a string in a set of
strings?
..
I have thought of putting the set of strings in a HashMap and then us
containsKey() to do the check but I don''t like because this is the
objective of HashMap.


...


...

对不起,我错过了打字。我的意思不是客观..
Sorry, I miss-typed it. I meant NOT the objective..



Ahaaa!谢谢你的澄清。
[正如你可能已经猜到的那样,
读得非常好。 ]

我希望卡尔的答案能解决问题吗?


Ahaaa! Thanks for clarifying.
[ As you may have guessed, that
read quite ..oddly. ]

I expect Carl''s answer solved the problem?




当然可以!

[已解散的组clj已删除*再次*]



Yes, of course!
[ defunct group c.l.j deleted *again* ]