Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have below string which I get from an xml file.
<product>
<aa>1367</aa>
<ac>133787</ac>
<db>13345</db>
<ce>133</ce>
<er>135</er>
<et>130</et>
<ef>14</ef>
</product>
How do I convert it to an two dimension array like
product[][]={{"aa", "1367"},{"ac","133787"}, {"db","13345"}....}
I only want to use string function and loop.
I think the best way is to use an available XML parser.
In this thread: Best XML parser for Java you'll probably find which one is the best to use
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I create a Hashmap xxx
store all Thread inside Hasmap
when Thread finish , will remove it
is it a good practise?
Here is my code : https://gist.github.com/extralam/756484718c9e0cd57ddb
The right way, since Java5, is the use of the ThreadPoolExecutor.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have a list that I made with a type I created of . I want to sort it in lexicographical order. I have seen the compareTo in Java, am I supposed to use this? I'm not sure how to put it into the lexographical format from a list? Can anyone show me an example? I have seen many examples, but I am not sure how to do it from a list.
Just use implement the Comparable<Type> in your own Type class and implement the compareTo method to match the lexicographical order. Than just call Collections.sort(yourlistOfTypes).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a text and I want to extract Parentheses of text with regex java.
for example of text:
<p>Now a days, regenerative medicine(1) in stem cell(3) filed
widely <label>attractive(10) by</label> attractive by scientists(4).</p>
if Parentheses exist between label tags,I want to extract all text between label tags.
for example of extract above text:
(1)
(3)
<label>attractive(10) by</label>
(4)
Try this:
(?is)\(\d+\)|<label>.*?\(\d+\).*?</label>
Demo
http://regexr.com?37ktp
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
is there any way to read from text file word by word (i.e without using split)? . I am able to read line by line directly with nextLine() with a scanner object, but I got error when I tried with next(). Thanks in advance.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a list of names (surnames) and a simple search mechanism. I would like to have words with minor changes (typos) shown in search results.
Example search text: braniecka
Example result: Branicka, Kraniecka, Braniecki
Any help appreciated.
You can implement the Levenshtein distance. It is a widely used algorithm.
You could also consider upgrading your solution to Lucene, especially if you are doing any production work. Lucene handles your requirement in an extremely performant way (no brute-force exhaustive search).
Try using simmetrics.
Is a library for measuring string similarity and implements many algorithms.
http://sourceforge.net/projects/simmetrics/