如何从Iterable< String>打印单个字符串 [英] How to print out individual Strings from Iterable<String>

查看:86
本文介绍了如何从Iterable< String>打印单个字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法从Interable对象中打印出各个字符串. 我有这个给定的函数prefixMatch(String someword)返回Iterable(我认为它保留了Strings的LinkedList).我曾尝试将其转换为列表,但无法正常工作.有谁知道如何一一拿出琴弦?

I am having trouble printing out individual Strings from Interable object. I have this given function prefixMatch(String someword) that returns Iterable (that keeps a LinkedList of Strings, I think). I have tried turning it into a list but it wont work. Dose anyone know how to get the Strings out of it one by one?

tst是三元搜索树

Iterable<String> words = tst.prefixMatch(word);

推荐答案

如果它是 Iterable ,您可以对其进行扩展.

If it's Iterable you can do an extended for on it.

Iterable<String> iterable;
for(String s : iterable){
    //Do whatever you want
}


资源:

相关主题:

这篇关于如何从Iterable&lt; String&gt;打印单个字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆