How to split a string having string as delimiter instude of char?
Hello Gurus,
I want to split the string and work on each split string.
The following code will do, but not exactly.
It's split into morethan three strings, where coma find.
But I want to split it using #,# as delimiter.
Here is my code:
//File fileData = new File("myfile.txt");
// This will have coma separated fields data
// while traversing this file will readLine() give the string, that is strRecord
// BufferedReader bfrdRdrObj = new BufferedReader(new FileReader(strDataFile));
//while ((strThisLine = bfrdRdrObj.readLine()) != null) {..........
String strRecord = #A001#,#User1#,#this is record, so need to split and place, insert into table#;
StringTokenizer strTknRec = new StringTokenizer(strRecord,"#,#");
int iCounter=0;
while(strTknRec.hasMoreTokens()){
System.out.println(++iCoutner+"Field: "+strTknRec.nextToken());
Please, give me hint.
Thanks in advance.
~ SubbaReddy .M
Hello Guru,
Here "myfile.txt" CSV file.
each line represented treated as a record and coma seperated string is treated as fields.
But, one of the fields data may have the coma in the string itself. So, # or " (double quote) has been place before and end of the field data as a string qualifier.
//File fileData = new File("myfile.txt");
// This will have coma separated fields data
// while traversing this file will readLine() give the string, that is strRecord
// BufferedReader bfrdRdrObj = new BufferedReader(new FileReader(strDataFile));
//while ((strThisLine = bfrdRdrObj.readLine()) != null) {..........
String strRecord = #A001#,#User1#,#this is record, so need to split and place, insert into table#;
StringTokenizer strTknRec = new StringTokenizer(strRecord,"#,#");
int iCounter=0;
while(strTknRec.hasMoreTokens()){
System.out.println(++iCoutner+"Field: "+strTknRec.nextToken());
And I would like to run this JRE 1.3.1
Hope, String.split() in JRE 1.4.0 beta will some what resolve this.
But, how to do it on JRE 1.3.1
Please, give me hint.
Thanks in advance.
Similar Messages
-
How to split an array (*not String*) into smaller arrays?
Hello,
let's say you have an array of bytes whith length (for example) 5000B. Now you want to split this array into smaller ones, for example 1500B. Then you will have 3 arrays of 1500B and another one of 500B. What I try to do then is the following:
pointer = 0;
size = source.length; // For example, size = 5000
maxsize = 1500;
while ((size - pointer) > maxsize) {
byte[] dest = new byte[maxsize];
System.arraycopy(src, pointer, dest, pointer, maxsize); // <--- Errors here!
pointer += maxsize;
// Do some stuff here with the dest array
}There's no errors at compile time. But at runtime, the first iteration everything works OK (the 1500 first bytes are copied to the dest array). However, in the second iteration, the java interpreter claims:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)And I don't know what I'm doing bad. I guess there's a stupid question I can't see by myself... Help wanted, please!> System.arraycopy(src, pointer, dest, pointer, maxsize);should be
System.arraycopy(src, pointer, dest, 0, maxsize);Since you're copying to the first position in the destination array. -
How to split numbers in a string with a single SQL on 10.2?
Is it possible to to below action with a single SQL on 10.2?
input > '3abc4de5f'
output > '3,abc,4,de,5,f'
Thank you.It might be a NLS issue. Follow the suggestion of Karthick_Arp and use [[:alpha:]] instead:Is is
SQL> with t as (select 'a' l from dual union all
select 'b' l from dual union all
select 'A' l from dual)
select * from t
order by nlssort(l, 'NLS_SORT=GERMAN')
L
a
A
b
3 rows selected.
SQL> with t as (select 'a' l from dual union all
select 'b' l from dual union all
select 'A' l from dual)
select * from t
order by nlssort(l, 'NLS_SORT=DANISH')
L
A
a
b
3 rows selected.You could also do a case insensitive match (As in TXT3)
SQL> alter session set NLS_SORT=DANISH
Session altered.
SQL> with t as (select 'aADSFF3332abc4342de5Df' txt from dual
union all
select '3abc4de5f' from dual)
select txt, regexp_replace(txt, '([0-9]{1,}|[a-z]{1,})', '\1,') txt2
,regexp_replace(txt, '([0-9]{1,}|[a-z]{1,})', '\1,', 1, 0, 'i') txt3
from t
TXT TXT2 TXT3
aADSFF3332abc4342de5Df a,ADSFF,3332,abc,4342,de,5,Df, aADSFF,3332,abc,4342,de,5,Df,
3abc4de5f 3,abc,4,de,5,f, 3,abc,4,de,5,f,
2 rows selected.
SQL> alter session set NLS_SORT=GERMAN
Session altered.
SQL> with t as (select 'aADSFF3332abc4342de5Df' txt from dual
union all
select '3abc4de5f' from dual)
select txt, regexp_replace(txt, '([0-9]{1,}|[a-z]{1,})', '\1,') txt2
from t
TXT TXT2
aADSFF3332abc4342de5Df aADSFF,3332,abc,4342,de,5,Df,
3abc4de5f 3,abc,4,de,5,f,
2 rows selected.Regards
Peter -
When I forward an e-mail, I get a long string of gobblygook that goes with it and I cannot figure out how to eliminate it without having to delete it every time I forward an e-mail. The following is only part of the string that I am talking about. How can I eliminate this from the e-mail?
Here is part of an excerpt from one of the strings:
From: - Mon Aug 19 18:12:47 2013
X-Account-Key: account1
X-UIDL: 065B31352CC6B3C0789DEA7954395B55
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
X-Mozilla-Keys:
Return-Path: <[email protected]>
Received: from hrndva-mxlb.mail.rr.com ([10.128.255.126]) by hrndva-imta07.mail.rr.com with ESMTP id <20130819211326470.DBUO12525@hrndva-X-Roving-StreamId: 0Sorry, Firefox doesn't do email, it's strictly a web browser.
If you are using Firefox to access your mail, you are using "web-mail". You need to seek support from your service provider or a forum for that service.
If your problem is with Mozilla Thunderbird, see this forum for support.
[https://support.mozillamessaging.com/en-US/home] <br />
or this one <br />
[http://forums.mozillazine.org/viewforum.php?f=39] -
My string is:
String string = "39934,,\"VIE\",\"Cong, hoa, xa, hoi\""
Now, i want to split into array:
a[0]="39934"
a[1]=""
a[2]="\"VIE\""
a[3]="\"Cong, hoa, xa, hoi\""
How i do?thanhhaunv wrote:
Now, i want to split into array:
a[0]="39934"
a[1]=""
a[2]="\"VIE\""
a[3]="\"Cong, hoa, xa, hoi\""[String.split()|http://java.sun.com/javase/6/docs/api/java/lang/String.html#split%28java.lang.String%29] will do the basics for you; but it's naive.
ie, If any of your quoted strings contain commas and you don't want them split, you'll have to put them back together in a step 2.
Winston -
How to split the string by datetime in sql
Hi,
How to split the string by datetime in sql, I've a table with comments column stores comments by datetime, while selecting I want to split and show as in rows by each jobref.
can anyone help me in this please.
Thanks,declare @callcentre table (comments varchar(max),lbiref varchar(200))
insert into @callcentre
select '(28/10/2014 14:56:14) xyz ..... call logged (28/10/2014 14:56:58) xyz ..... call updated (28/10/2014 14:57:41)xyz ..... call updated','Vi2910201'
insert into @callcentre
select '(29/10/2014 14:56:14) xyz ..... call logged (29/10/2014 14:56:58) xyz ..... call updated (29/10/2014 14:57:41)xyz ..... call updated','Vi2910202'
insert into @callcentre
select '(30/10/2014 14:56:14) xyz ..... call logged (30/10/2014 14:56:58) xyz ..... call updated
output:
1) 28/10/2014 14:56:14, (28/10/2014 14:56:14) xyz ..... call logged ,'Vi2910201'
2) 28/10/2014 14:56:58 ,(28/10/2014 14:56:58) xyz ..... call updated ,'Vi2910201'
3) 28/10/2014 14:57:41, (28/10/2014 14:57:41)xyz ..... call updated,'Vi2910201'
4) 28/10/2014 14:56:14, (28/10/2014 14:56:14) xyz ..... call logged ,'Vi2910202'
5) 28/10/2014 14:56:58 ,(28/10/2014 14:56:58) xyz ..... call updated ,'Vi2910202'
6) 28/10/2014 14:57:41, (28/10/2014 14:57:41)xyz ..... call updated,'Vi2910202'
7) 28/10/2014 14:56:14, (28/10/2014 14:56:14) xyz ..... call logged ,'Vi2910203'
8) 28/10/2014 14:56:58 ,(28/10/2014 14:56:58) xyz ..... call updated ,'Vi2910203'
Thanks,
See this illustration
declare @callcentre table (comments varchar(max),lbiref varchar(200))
insert into @callcentre
select '(28/10/2014 14:56:14) xyz ..... call logged (28/10/2014 14:56:58) xyz ..... call updated (28/10/2014 14:57:41)xyz ..... call updated','Vi2910201'
insert into @callcentre
select '(29/10/2014 14:56:14) xyz ..... call logged (29/10/2014 14:56:58) xyz ..... call updated (29/10/2014 14:57:41)xyz ..... call updated','Vi2910202'
insert into @callcentre
select '(30/10/2014 14:56:14) xyz ..... call logged (30/10/2014 14:56:58) xyz ..... call updated','Vi2910203'
SELECT LEFT(p.u.value('.[1]','varchar(max)'),CHARINDEX(')',p.u.value('.[1]','varchar(max)'))-1) AS [Date],
'(' + p.u.value('.[1]','varchar(max)') AS comments,
lbiref
FROM
SELECT lbiref,CAST('<Root>' + STUFF(REPLACE(comments,'(','</Data><Data>'),1,7,'') + '</Data></Root>' AS XML) AS x
FROM @callcentre c
)t
CROSS APPLY x.nodes('/Root/Data')p(u)
and the output
Date comments lbiref
28/10/2014 14:56:14 (28/10/2014 14:56:14) xyz ..... call logged Vi2910201
28/10/2014 14:56:58 (28/10/2014 14:56:58) xyz ..... call updated Vi2910201
28/10/2014 14:57:41 (28/10/2014 14:57:41)xyz ..... call updated Vi2910201
29/10/2014 14:56:14 (29/10/2014 14:56:14) xyz ..... call logged Vi2910202
29/10/2014 14:56:58 (29/10/2014 14:56:58) xyz ..... call updated Vi2910202
29/10/2014 14:57:41 (29/10/2014 14:57:41)xyz ..... call updated Vi2910202
30/10/2014 14:56:14 (30/10/2014 14:56:14) xyz ..... call logged Vi2910203
30/10/2014 14:56:58 (30/10/2014 14:56:58) xyz ..... call updated Vi2910203
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
How To Split the String for "."
Hi Friends
I am Using Following Code to Split one String.
String str = "Jeetendra.choudhary";
String[] sp_str = str.split(".");
wdComponentApi.getMessageManager.reportSuccess(str[0]);
wdComponentApi.getMessageManager.reportSuccess(str[1]);
but its throwing null pointer exception.
when i am using following code its working fine.
String str = "Jeetendra/choudhary";
String[] sp_str = str.split("/");
wdComponentApi.getMessageManager.reportSuccess(str[0]);
wdComponentApi.getMessageManager.reportSuccess(str[1]);
what may be the issue and how to split the string with "." ?
Thanks & Regards
Jeetendra"." is a special character.
Use
str.split("\\.");
Regards
Benjamin
Edited by: Benjamin Hansen on Dec 29, 2009 7:52 AM -
How to split a string with linefeed character ( LF ) as a delimiter in VB6?
Hi. I am writing a small program in VB 6.0.
I have a string named Data and it contains few characters along with <LF> in it. ( <LF> is a new line/line feed character).
I want to split this string with <LF> as delimiter and store the tokens in an array. I tried with split function and its giving me type mismatch error. Can anyone tell me how to do it?
I am giving the pseudo-code below.
Dim Data as string
Data = "hello, how are you<LS>good morning guys <LS> hi"
Dim strarray() as stringMsgbox(Data)
strarray = split(Data, "<LS>")
When i see the Data in message box before split function, it shows up in different lines like this:
hello, how are you
good morning guys
hi
I want the final array strarray to be like this: strarray(0) = "hello, how are you"
strarray(1) = "good morning guys "
strarray(2) = " hi"
The spaces can be as it is. Just i need the string to be delimited wherever <LS> is there.
Please help me as soon as possible. Though it is small one, i am stuck here.
Thanks in advance,
Satya.Hello,
This forum is for VB.NET, please check the following resources
http://www.vbforums.com/forumdisplay.php?1-Visual-Basic-6-and-Earlier
http://social.msdn.microsoft.com/Forums/vstudio/en-US/6a0719fe-14af-47f7-9f51-a8ea2b9c8d6b/where-to-post-your-vb-6-questions?forum=vbgeneral
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. -
How to split string in data table row in c#
hi,
Binding List data in to data table,. in that table i have description column. this column data move to data table in sql server
here we facing problem for Description column
the description column having data is
<div class="ExternalClassE4908D8C25DF4D1586D0A010BFBC5A53">3400</div>
now we want only 3400 values i am using this code
ring Descrption = rows["Description"].ToString();
if (! string.IsNullOrEmpty(Descrption))
char[] splitString = new char[] { '<', '>' };
string[] parts = Descrption.Split(splitString,
StringSplitOptions.RemoveEmptyEntries);
// string[] Dec_1 = Dec.Split(new char[] { '<' }, StringSplitOptions.RemoveEmptyEntries);
rows["Description"] = parts[1].ToString();Hope the below helps as start..Modify
//Option1
Descrption = Descrption.Substring(0, Descrption.LastIndexOf("<"));
Descrption = Descrption.Substring(Descrption.LastIndexOf(">") + 1);
Console.WriteLine(" {0} ", Descrption);
//Option2
Console.WriteLine(" {0} ", Regex.Replace(Descrption, "<[^>]*>", string.Empty));
accordingly.. -
how to split this string (char1)char2(char3)char4 into (char1)char2 , (char3)char4?
String[] result = "(char1)char2(char3)char4".split("\\(");I want :
result[0] = "(char1)char2" and
result[0] = "(char3)char4"
acutally char1,char2,char3, char4 ... is in the form of the below.
(any charactors except round brace)any charactors except round brace(any charactors except round brace)any charactors except round brace
I prefer String.split and Pattern.compile().split.
Edited by: iamjhkang on Feb 5, 2009 3:37 PM
Edited by: iamjhkang on Feb 5, 2009 3:41 PMiamjhkang wrote:
especially on
?= and ?<
Thanks.The following:
(?=...) // positive look ahead
(?!...) // negative look ahead
(?<=...) // positive look behind
(?<!...) // negative look behindare all "look-arounds". See: [http://www.regular-expressions.info/lookaround.html] -
How to Search for a Date in a string having both characters and date
Hi ,
I have a requirement to search DATE in the String having Both Characters and DATE . Please kindly let me know as early as possible.
Regards
Anil Kumar KTry to use SEARCH command with the pattern, making the pattern as fine as it can, like if you have your date in the format 02/23/2007, you can give
SEARCH STRING FOR ' //'. (assuming the date has at least a single blank before it)
WRITE: SY-SUBRC UNDER 'SY-SUBRC',
SY-FDPOS UNDER 'SY-FDPOS'.
SY-FDPOS is set to offset of the string from which you can get the date value
Refer here
http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb33cc358411d1829f0000e829fbfe/frameset.htm
It would have been better if there is something like UNIX "regular expression" matching in ABAP -
How to split a string around "." expression
My code is:
public String removeExtn(String resource){
String[] splittedName = resource.split(".");
System.out.println("LENGHT IS: "+ splittedName.length);
if(splittedName.length >= 3)
resource = splittedName[0]+ "." + splittedName[1];
return resourceName;
* @param args
public static void main(String[] args) {
Test obj = new Test();
System.out.println(obj.removeExtn("myfile.xml.sample"));
But it doesn't split the string around "." and given the arraylength 0. But if I try to use any another character (e.g. "," or ";") it works perfectly fine.
Please help me.
Thanks in advance.
MansiHi mansi,
I had a same kind of problem a few days back.
What I learned was the split() method has a string expression in it, which is usually noted as regex .
'Regex' is just a short form for 'regular expression'
You may directly use the string variable you would split around in some cases or may want to use a '\\' before some of the characters.
I can't place whole information here .So, let me give you that sun site link I read it from.
This link deals with the whole string class.
You may want to ctrl+F and split to read on split method.
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.htmlThis link talks about the regular expressions
http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html#sumI got his for you from that link :
\p{Punct} Punctuation: For One of !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ This is for your knowledge.
And if you want a quick fix just for your code...
that'ld be using a
split(\p{.}) in place where u used a split(.)I have not tried that ...but u may want to!
Hope that helps.
Message was edited by:
Kishorei20
Message was edited by:
Kishorei20 -
How to split string based on either space or tab delimitation?
I'm trying to split a string into 4 fields. The strings sometimes have space delimitation and sometimes have tab delimitation. Is there any way to do this in a SELECT, or do I need a couple staging tables, or what?
I'm trying to work with this.
Select PARSENAME(replace(replace(replace(replace([Column 0],' ','<>'),'><',''),'char(9)',' '),' ','.'),4) Date,
PARSENAME(replace(replace(replace(replace([Column 0],' ','<>'),'><',''),'char(9)',' '),' ','.'),3) ID,
PARSENAME(replace(replace(replace(replace([Column 0],' ','<>'),'><',''),'char(9)',' '),' ','.'),2) Rank1,
PARSENAME(replace(replace(replace(replace([Column 0],' ','<>'),'><',''),'char(9)',' '),' ','.'),1) Rank2
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.This is similar thread that someone posted a week ago
Split delimited string into separate columns
based on space
My solution was, using a user defined function to split the text:
Use Master
Go
CREATE FUNCTION dbo.udf_SplitString(@InputVal VARCHAR(200), @Delimiter CHAR(1))
RETURNS @Items TABLE (RowNo TINYINT, ITEM VARCHAR(100))
As
BEGIN
DECLARE @FieldLen TINYINT = 0, @FieldEnum TINYINT = 0, @TempItem VARCHAR(100) = '', @ItemLoop TINYINT = 1
SET @FieldLen = LEN(@InputVal)
WHILE @FieldEnum <= @FieldLen
BEGIN
IF (SUBSTRING(@InputVal, @FieldEnum + 1, 1) = @Delimiter OR @FieldEnum = @FieldLen) AND @TempItem <> ''
BEGIN
INSERT @Items (RowNo, Item)
VALUES (@ItemLoop, LTRIM(RTRIM(@TempItem)))
SET @TempItem = ''
SET @ItemLoop += 1
END
ELSE
BEGIN
IF SUBSTRING(@InputVal, @FieldEnum + 1, 1) <> @Delimiter
BEGIN
SET @TempItem = @TempItem + SUBSTRING(@InputVal, @FieldEnum + 1, 1)
END
END
SET @FieldEnum += 1
END
RETURN
END
Next, use the splited data to group based on requirements
DECLARE @AllData TABLE
[Column 0] VARCHAR(50)
INSERT INTO @AllData
VALUES('20150101 04559690 45 33')
INSERT INTO @AllData
VALUES('20150101 045595320 42 48')
INSERT INTO @AllData
VALUES('20150101 041198690 44 34')
INSERT INTO @AllData
VALUES('20150101 0455222130 41 49')
INSERT INTO @AllData
VALUES('20150101 554567450 40 51')
;WITH CTE
AS
SELECT
,Row_Number() OVER(PARTITION BY MainQry.[Column 0] ORDER BY MainQry.[Column 0]) As RowNo
FROM
@AllData As mainQry
CROSS APPLY (SELECT Item FROM Master.dbo.udf_SplitString(REPLACE(MainQry.[Column 0], CHAR(9), ' '), ' ')) As SubQry
SELECT
[Column 0]
,MAX(CASE WHEN RowNo = 1 THEN Item ELSE '' END) AS [DATE]
,MAX(CASE WHEN RowNo = 2 THEN Item ELSE '' END) AS [ID]
,MAX(CASE WHEN RowNo = 3 THEN Item ELSE '' END) AS [Rank1]
,MAX(CASE WHEN RowNo = 4 THEN Item ELSE '' END) AS [Rank2]
FROM
CTE
GROUP BY
[Column 0]
Output
Column 0 | DATE
| ID
| Rank1 | Rank2
20150101 0455222130
41 49
| 20150101
| 0455222130
| 41 | 49
20150101 554567450
40 51
| 20150101
| 554567450
| 40 | 51
20150101 041198690 44 34
| 20150101
| 041198690
| 44 | 34
20150101 045595320 42 48
| 20150101
| 045595320
| 42 | 48
20150101 04559690 45 33
| 20150101
| 04559690 | 45
| 33
Best Wishes, Arbi; Please vote if you find this posting was helpful or Mark it as answered. -
How do I deal with Tokenized strings that are blank?
I'm writing a little application that writes data to a file. It sends data to the file as a "|" delineated string. Then I use tokenizer to break up the string as follows:
try {
String searchtext = SearchTxt.getText();
String tokenString = "";
String[] returnData = new String[8];
File filedata = new File("bigbase.txt");
BufferedReader in = new BufferedReader(
new FileReader(filedata));
String line = in.readLine();
while ( line != null) {
Pattern pat = Pattern.compile(searchtext);
Matcher mat = pat.matcher(line);
if ( mat.find() ) {
StringTokenizer t = new StringTokenizer(line, "|");
maintextArea.setText("");
int count = 0;
while (t.hasMoreTokens()) {
tokenString = t.nextToken();
returnData[count] = tokenString;
maintextArea.append(tokenString + " ");
System.out.println(tokenString);
etc etc etc
The problem is that when the tokens are blank, I get an endless loop when I try to print out the data on that last line. How do I deal with Tokens that are blank so they don't endlessly loop my output?
Thanks
MrThisMost people would probably tell you to use:
String.split(...);
But I'm not most people and I wrote this class before regex support was added to the String class which is based on StringTokenizer but supports empty tokens:
http://www.discoverteenergy.com/files/SimpleTokenizer.java -
How to use Multimaps (Map String, ArrayList String )
I was using an array to store player names, userIDs, uniqueIDs, and frag counts, but after reading about multimaps in the tutorials, it seems that would be much more efficient. However, I guess I don't quite understand it. Here's how I wanted things stored in my string array:
String[] connectedUsers = {"user1_name", "user1_userid", "user1_uniqueid", "user1_frags"
"user2_name"...}and here is how I'm attempting to setup and use the 'multimap':
public class Main {
static Map<String, ArrayList<String>> connectedUsers;
public void updatePlayers(String name, String status) {
String[] statusSplit = status.split(" ");
if (connectedUsers.containsKey(name)) {
connectedUsers.put(name, statusSplit[0]);
else {
connectedUsers.put(name, statusSplit[0]);
}It's quite obvious I don't understand how this works, but should I even set this multimap up this way? Perhaps I should use a regular map with a string array for the values?You're cool MrOldie. Its just that alarm bells start ringing in my head when people come on and post as much as you do.
* Created on Jul 28, 2005 by @author Tom Jacobs
package tjacobs;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
* ManyMap is a map that allows more than one value to be stored with any key
* <p>
* There are a number of methods in the class that have been deprecated because
* the original functionality of Map has been violated to accomodate the concept
* of the ManyMap
public class ManyMap<T, T2> implements Map<T, T2> {
private HashMap<T, ArrayList<T2>> mInnerMap;
public ManyMap() {
mInnerMap = new HashMap<T, ArrayList<T2>>();
* @deprecated
public T2 get(Object obj) {
ArrayList<T2> ar = _get(obj);
if (ar == null || ar.size() == 0) {
return null;
return ar.get(0);
public Iterator<T2> getAll(Object obj) {
ArrayList<T2> ar = _get(obj);
if (ar == null || ar.size() == 0) {
return null;
return ar.iterator();
public T2 put(T obj1, T2 obj2) {
ArrayList<T2> ar = _getNotNull(obj1);
ar.add(obj2);
return obj2;
public Set<Map.Entry<T, T2>> entrySet() {
TreeSet<Map.Entry<T, T2>> entries = new TreeSet<Map.Entry<T, T2>>();
Iterator<T> _i = mInnerMap.keySet().iterator();
while (_i.hasNext()) {
T key = _i.next();
Iterator<T2> vals = mInnerMap.get(key).iterator();
while (vals.hasNext()) {
Entry<T, T2> entry = new Entry<T, T2>(key, vals.next());
entries.add(entry);
return entries;
public int size() {
return mInnerMap.size();
public int valuesSize() {
int vals = 0;
Iterator<T> _i = mInnerMap.keySet().iterator();
while (_i.hasNext()) {
T key = _i.next();
ArrayList<T2> ar = mInnerMap.get(key);
vals += ar.size();
return vals;
public void clear() {
mInnerMap.clear();
public void putAll(Map<? extends T, ? extends T2> map) {
Iterator _i = map.entrySet().iterator();
while(_i.hasNext()) {
Map.Entry<? extends T, ? extends T2> entry = (Map.Entry<? extends T, ? extends T2>) _i.next();
put(entry.getKey(), entry.getValue());
public Collection <T2> values() {
LinkedList ll = new LinkedList();
Iterator<ArrayList<T2>> _i = mInnerMap.values().iterator();
while (_i.hasNext()) {
ll.addAll(_i.next());
return ll;
public boolean containsValue(Object val) {
Iterator<ArrayList<T2>> values = mInnerMap.values().iterator();
while (values.hasNext()) {
if (values.next().contains(val)) return true;
return false;
public boolean containsKey(Object key) {
return mInnerMap.containsKey(key);
public T2 remove(Object obj) {
Iterator<ArrayList<T2>> values = mInnerMap.values().iterator();
boolean found = false;
while (values.hasNext()) {
if (values.next().remove(obj)) {
found = true;
return found ? (T2)obj : null;
public boolean isEmpty() {
return valuesSize() == 0;
@SuppressWarnings("hiding")
private class Entry<T, T2> implements Map.Entry<T, T2> {
T key;
T2 val;
public Entry (T obj1, T2 obj2) {
key = obj1;
val = obj2;
public T2 getValue() {
return val;
public T getKey() {
return key;
public T2 setValue(T2 obj) {
return val = obj;
public Set<T> keySet() {
return mInnerMap.keySet();
public ArrayList<T2> _get (Object obj) {
return mInnerMap.get(obj);
public ArrayList<T2> _getNotNull (T obj) {
ArrayList<T2> list = _get(obj);
if (list == null) {
list = new ArrayList<T2>(1);
mInnerMap.put(obj, list);
return list;
}Edited by: tjacobs01 on Aug 19, 2008 12:28 PM
Maybe you are looking for
-
A warning about your MacBook Pro (Do not let this happen to you)
If your MacBook Pro is nearing the end of its warranty do like be like me. Purchase the extended warranty! Just before the warranty ran out on my 17" MacBook Pro in December of 2007 the NVIDEA Graphics chip set failed. (8600GT). As you will see below
-
My dad has a iphone, but no longer has a PC. He does not want to buy a new computer, he is retired now and has no use for a PC or MAC. He does not have high speed internet to his house, just cellular service. He does not want to save pictures to the
-
What are all the features not supported in SQL Server 2012 trial version?
What are all the features not supported in SQL Server 2012 trial version?
-
Subtotals need to be substracted!
Hi everyone! My requirement is in one alv output i need two subtotals to be substracted from the total value and then the total value to be dsisplayed,can anyone help me please.... Thanks in advance, Regards, Parwez.
-
How was this done (Stacking)?
Hello! How was this effect done? http://www.riccardomagherini.com/fine_art/, I think I know how it is finished in PS, but how do you shoot this?