473,804 Members | 3,941 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ArrayList issue

1 New Member
Hi,

Basically i have 2 arraylist and 1 hashmap and i want to store the value inside the hashmap. but my codes seem never do any comparison.

Expand|Select|Wrap|Line Numbers
  1. for (String bigram1 : bigram) {
  2.             for (String words : a2) {
  3.                     if (words.contains(bigram1)){
  4.                       if(test.containsKey(bigram1)) {
  5.                       test.get(bigram1).add(words);
  6.                       }
  7.                     else {
  8.                       test.put(bigram1, new ArrayList<String>(a2));
  9.                     }
  10.                 }
  11.             }
  12.         }
  13.           System.out.println(test);
  14.  
instead it displayed all the values.

its should be like {ev = [every]} and not {ev = [every, errant, word]} because ev is substring belong to every and not errant and word.

Thanks.
Mar 14 '11 #1
0 984

Sign in to post your reply or Sign up for a free account.

Similar topics

4
1717
by: Kevin | last post by:
I'm converting some code from VB.NET to C#. I have strange behavior in an implemntation of an ArrayList. In VB.NET, the ArrayList is type safe at compile time, where the C# is not type safe at compile time (good). The C# code breaks at run time (bad). Here is the sample code: VB.NET Public Class Country Private _countryName As String Private _capitalName As String
7
1799
by: Dave | last post by:
Hi all, I have... using System.Collections; namespace MyApp.Templates { public class MyPage : System.Web.UI.Page { ArrayList MyArray = new ArrayList();
1
2695
by: sd | last post by:
QUESTION: How can my ASP page - which uses language="VBScript" - pass a "System.Collections.ArrayList" object - as a parameter - to a C# method in the middle-tier ??? ----- Is it possible at all? - if not, what work-a-round is there? I have no issues passing "string" parameters successfully to other methods in the same "middle-tier" - i.e., C# - object... It just seems to be the "ArrayList" parameter that is at issue.
4
2829
by: Peter | last post by:
I run into this situation all the time and I'm wondering what is the most efficient way to handle this issue: I'll be pulling data out of a data source and want to load the data into an array so that I can preform complicated operations against this data. The returned record count in these operations is always variable. 1. I have been using an arraylist.add function to handle non-multidemional returns but was wondering if I'm better...
6
2026
by: Earl | last post by:
Anyone know how to get rid of this late binding issue? SalutationList is a listarray of all salutation objects from a lookup table. Dim a As Int32 = SalutationList.Count For a = 0 To a - 1 If IsDBNull(dv.Item(0).Item("SalutationID")) = False Then 'this is the latebinding problem If dv.Item(0).Item("SalutationID") = CInt(SalutationList.Item(a).SalutationID) Then cmbSal.Text = CStr(SalutationList.Item(a).Salutation)
48
4493
by: Alex Chudnovsky | last post by:
I have come across with what appears to be a significant performance bug in ..NET 2.0 ArrayList.Sort method when compared with Array.Sort on the same data. Same data on the same CPU gets sorted a lot faster with both methods using .NET 1.1, that's why I am pretty sure its a (rather serious) bug. Below you can find C# test case that should allow you to reproduce this error, to run it you will need to put 2 data files into current directory...
2
2380
by: csgraham74 | last post by:
Hi Guys, Just wondering if someone could help me with an arraylist issue. I have an array of integers Arraylist 4 , 2, 11, 2, 21, 3 ,15 , 30 i want the arraylist to now be sorted according to the values either
6
2818
by: Vinit | last post by:
Hi I am passing an arraylist to a c#/.net webmethod from a perl client using soap:lite. The trace shows the elements in the xml request. The arraylist input in the webmethod however does not contain any values and is empty. It works fine with arrays....but NOT arraylists....does anyone know WHY? and HOW TO SOLVE THIS ISSUE? Regards,
1
1475
tifoso
by: tifoso | last post by:
I searched here and only found somebody with a round-robin arraylist issue here but what they suggest I tried already and it doesn't work for me I hope somebody can shed some light Scenario: I'm porting a PalmOS App written on C to .NET initially for a desktop and then to the CF, generic stuff is not biggie I have a section where data comes in bursts and updates an array on a LIFO way, in C using a Memcopy gets this done in a few lines...
5
3012
by: blt51 | last post by:
I need to write a program that handles a bank account and does a number of transactions using an arraylist. However, I'm having trouble getting the arraylist to store all the transactions and then output them. There are 2 classes, Bank and BankAccount. I also have a tester. Any help would be appreciated. Bank package bank; import java.util.ArrayList; /** This bank contains a collection of bank accounts.
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2995
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.