Vector.contains (using a custom object)...

hi!
This is probably a simple question, but I just dont know the answer...
I have created a vector that contains objects; those objects contain (1) String and (2) int.
What i want to do is create a custom .contains function to search the vector for only the string, rather than the string and the number wrapped in the object.
So.. If I were to write myVector.contains("Java") - I would want to know if the word "Java" existed in the vector
already, while ignoring the integer value associated with it.
Any ideas? -- code below
Vector myVector = new Vector<myObject>();
myObject{
String text;
int num;
}

As suggested, use a different data structure. Is the String unique? Then a Map is a perfect fit.
[http://java.sun.com/docs/books/tutorial/collections/index.html]

Similar Messages

  • Using a Custom Object to allow an Entity to link to itself

    Hey folks,
    Have a feeling the answer to this is No, but have to ask anyway.
    Is there any way that anyone is aware of to use a Custom Object to link an Entity to itself? For example... We have a CO (Custom Object) which is linked to Service Request. I want to link this CO to Service Request again, allowing one Service Request to be linked to another Service Request via the CO. I can obviously link Service Request to the CO, but the second link doesn't seem likely.
    Cheers,
    Mark

    You can link multiple Service Requests to a single Custom Object (1-3) very easliy. Just expose SRs under related items on the Custom Object and adjust Access Profiles appropriately. Alternately, you can add Custom Objects to related items on the Service Request page layout so SRs can be linked to multiple COs.
    In the end, you can end up with one CO linked to multiple SRs. This should give you what you are looking for - there may be more elaborate solutions involving multiple advanced custom objects.
    The key, of course, is how you need this data to be viewed or reported on. You'll need to assess this solution to see if the output is what you require.

  • Event Bubbling Custom Object not inheriting from control

    One of the new things flash flex and xaml have are ways which
    the event easily bubbles up to a parent that knows how to handle
    the event. Similar to exceptions travel up until someone catches
    it.
    My goal is to use the frameworks event system on custom
    objects. My custom objects are:
    ApplicationConfiguration
    through composition contains:
    SecurityCollection which contains many or no SecurityElements
    and
    FileSystemCollection.cs which contains many or no
    FileSystemElement objects
    ect ect basically defining the following xml file with custom
    objects.
    [code]
    <ApplicationConfiguration>
    <communication>
    <hardwareinterface type="Ethernet">
    <ethernet localipaddress="192.168.1.2" localport="5555"
    remoteipaddress="192.168.1.1" remoteport="5555" />
    <serial baudrate="115200" port="COM1" />
    </hardwareinterface>
    <timing type="InternalClock" />
    </communication>
    <filesystem>
    <add id="location.scriptfiles" value="c:\\" />
    <add id="location.logfiles" value="c:\\" />
    <add id="location.configurationfiles" value="c:\\" />
    </filesystem>
    <security>
    <add id="name1" value="secret1" />
    <add id="name2" value="secret2" />
    </security>
    <logging EnableLogging="true"
    LogApplicationExceptions="true" LogInvalidMessages="true"
    CreateTranscript="true" />
    </ApplicationConfiguration>
    [/code]
    basically these custom objects abstract the xml details of
    accessing attributes, writing content out of the higher application
    layers.
    These custom objects hold the application configuration which
    contains the users options. The gui application uses these
    parameters across various windows forms, modal dialog boxes ect.
    The gui has a modal dialog that allows the user to modify these
    parameters during runtime.
    basically i manage: load, store, new, edit, delete of these
    configuration files using my custom objects.
    Where would event propagation help in custom objects like
    described above?
    ConfigurationSingleton.getInstance().ApplicationConfiguration.CommunicationElement.Hardwar eInterfaceElement.EthernetElement.RemoteIPAddress
    =
    System.Net.IPAddress.Parse(this.textBoxRemoteEthernetIpAddress.Text);
    The EthernetElement should propagate a changed event up to
    the parent ApplicationConfiguration which would persist this to the
    registry, db, file or whatever backend.
    currently this logic is maintained else where. I serialize
    the root node which compositely serializing the nested nodes and i
    check of the serialization is different from that in the backend
    … This tells me if the dom was modified. It works but i would
    like an event driven system.
    how should i implement bubbling using custom objects?
    3 implementation ideas:
    1) A simple way is to implement a singleton event manager:
    EventManager.RegisterRoutedEvent
    http://msdn2.microsoft.com/en-us/library/ms742806.aspx
    I like this idea but how can you tell which object is nested
    in who… this way the event can be stopped and discontinue
    propagation?
    2) If i use binders as discussed in Apress’s book:
    Event-Based
    Programming Taking Events to the Limit
    basically a binder connects the events between seperate
    objects together… although it would work for my app, I would
    like a more generalized approach so i can reuse the event system on
    future project.
    3) how does flash flex handle this..
    objectproxy.as?
    http://www.gamejd.com/resource/apollo_alpha1_docs/apiReference/combined/mx/utils/ObjectPro xy.html#getComplexProperty()
    >Provides a place for subclasses to override how a complex
    property that needs to be either proxied or daisy chained for event
    bubbling is managed.
    how does these systems all work....? Reflection ?
    this way i can simulate this on my own custom classes.
    Thanks!

    I have a strong sensation that the OSMF project is quite dead.
    no new submits since 2010, the contact form on the offical OSMF
    project website http://www.opensourcemediaframework.com/
    returns a PHP error.
    and many unanswered questions about OSMF in this forum.
    i think it would be wise to not use OSMF if possible, although
    I'm also stuck with it since we are utilizing HDS/PHDS
    protocols which are utilized in the framework.
    otherwise its quite a head-ache.
    I'm unable to get to a video element coming from a proxied element
    that is being produced via an HDS connection.
    and haven't found any solution that works.

  • Error when trying to create custom object

    Hi,
    The error below occurs when I am trying to create a new form that was created using the customer object 1 form.
    No language independent code exists for value 'English - United States' and type 'OCC_CUST_ZOBJ_1_LOV_3' with language 'ENU' in table 'S_LST_OF_VAL'.(SBL-DAT-00510)
    Has anyone seen this before?
    thanks

    David, I would recommend contacting On Demand customer care.

  • Auto-populate fields in Custom Object Based on Another Record

    Hello,
    I am hoping to auto-populate a few default values in a new Custom Object record based on an associated Lead record. The layout is this:
    I use the Lead record to take care of most of the information in the sales stages until the product is sold. The Lead record has fields to record information for a one product sale. The sales person can then use the Custom Object (called 'GX Additional Product') (which shows up in the Related Information section of the Lead record) to add additional items to a sales order request. Many of the fields in the GX Additional Product (custom object) record are identical to fields already filled out in the Lead record.
    What I would like to do, is when a new GX Additional Product (custom object) is added to the Lead record, those identical fields already filled out in the Lead record, by default, populate the corresponding fields in the new GX Additional Product (custom object) record.
    Is this possible? Is this something that can be done with JoinFieldValues? If so, I've had a bit of confusion trying to set up a JoinFieldValues expression.
    If you have any information to share that would be helpful, that would be greatly appreciated! THANKS!

    Hi,
    You can use JoinFieldValue to Custom Objects from other entities, cause you will have other objects' ID recorded inside the CO's, when you open a new detail record associated with the parent. Make sure your custom object is showing as a detail section (N:1) into lead´s main page. Try with one field first, using the exact syntax provided at samples listed at product documentation.
    regards,
    Flavio Amorim
    Brazil
    www.triscal.com.br

  • Report on activities linked to custom object

    Hi,
    Is there a way show on a report each activity linked to a custom object record? e.g.
    Custom Object name 1 , Activity 1 subject
    Custom Object name 1 , Activity 2 subject
    Custom Object name 1 , Activity 3 subject
    When i use the Custom Object 1 reporting area i add the custom object "name" feild to my report then add "Activity Subject". Each custom object record can have many activity records, however when I run my report it says "No Results" despite there being data set up?
    I tried a similar report but instead of showing activities i tried accounts, of which there are a number linked to a single custom object record. When i ran the report it showed a single row for each custom object record, almost as though it was a one to one realtionship between custom object and account, rather than a one to many?
    Any thoughts on what might be going wrong? or how i can report on activities per custom object record?
    Thanks

    Using CO and account subject area, it should be possible to show M:M associations between CO and Account.
    But for CO and activity, reporting on M:1 association alone is possible using CO subject areas.

  • JoinFieldValue function and custom object 4,5

    Hi,
    Can JoinFieldValue function be used for custom objects 4 and 5? If I want to update the Account field on custom object 5 based on the Account field in custom object 4, can this be done using JoinFieldValue ? How?
    Regards,
    Ani.

    Hi Ani,
    Currently JoinFieldValue is not supported in Custom Objects 04-15. You will have to use web services for Updating Account field on Custom Object 5 or else you can try the URL method to update the Account field .
    Thanks & Regards
    Sablok

  • How to make a custom object function the same as the Competitor and Partner

    Would like to use a custom object to function the same way the Competitor and Partner objects work in CRM. I have not be able to accomplish this. Do you know if it is possible? Can the specialized functionality of the account relationships fields and layouts be leverage with a custom object?

    Hi Peter. Thanks for the reply.
    I assumed that if I used the project style sheet during the export, Word would convert the style so that it looked the same as in the HTML. Is that a bad assumption? I'm currently not mapping to any template equivalent for these message box styles. I did try it as one of my attempts, but I couldn't figure it out. It never seemed to take the style in the .dot.
    Anyway, if I use just 1 style, such as just the MsgBox, I obviously don't get the white paragraph between the title and message. That white paragraph comes from the first <p> tag in the MsgBox style. But I need to have the <p> tags in there because they're better for our localization process than line breaks.
    I did do some tweaks that made it look better. Basically I structured it so that the MsgBoxTitle div is now inside the MsgBox div. Something like this:
    <div class="MsgBox">
        <div class="MsgBoxTitle">PC-DMIS MESSAGE: </div>
        <p>Please do the following steps in the indicated order.</p>
        <p>1. Remove the current SH-1/2/3 stylus.</p>
        <p>2. Attach the SHSP (Stylus Holder Setting Piece).</p>
        <p>3. Jog the probe to a safe location with a clear line of approach
         to the port(s) being calibrated.</p>
        <p>4. Then click OK.</p>
        <p>After you click OK the machine will begin DCC measurement.</p>
    </div>
    And then I adjusted my styles borders, padding, and thickness. That helped it look more connected, but still doesn't look quite right:
    Would love to get rid of that white space after the title.
    If you have time, I would be interested in a more detailed example of how you did it.

  • Custom Object assistance ....

    Here's the situation:
    I am using the Account Object, Custom Object 01 and then Custom Object 03 as the intersection between the Account and Custom Object 01. This seems to be working fine, however, there is something which I think is odd happening. When viewing the account which has a related object exposed for Custom Object 3 (the intersection table), if I select remove, it removed the record, however the relationship still exists under custom object 3. I would have expected the entire relationship (the record in the intersection component) to be fully removed.
    Am I doing something wrong or does this seem to be a flaw in the system ? Any thoughts ????

    What I'm trying to do is setup a many-to-many relationship between accounts and 'systems' (custom object). I have used a custom object to define all the 'systems' available. Then I am using another custom object to link the account and system together with additional custom fields to hold various pieces of information which applies to the relationship between the two. Doing this I can see the information from either the account or 'system' side.
    Are you saying I should not use Custom Object 3 since it is meant to function independently? I could use one of the custom 4-15 objects, but then the problem arises of not being able to WS or Import into them !! Maybe it's a catch-22!

  • Contact associated Custom object records in SR when contact is selected

    Hi
    We have a scenario like this:
    Contact->Family members
    For Contact - Contact Record Type
    For Family members - using Custom Object 1 record type
    This is fine. Whenever a family member is added, ContactId is stamped against the Custom object 1 record. So, when the contact is searched, the family members are also displayed in the child.
    Problem:
    Whenever there is a SR raised against the Contact, the child of SR should show up Family member names of the selected Contact. These records should be editable.
    Have anyone come across such problem or do anyone have a good solution without using Web Services or any kind of integration here?
    Regards,
    Suchitra

    Hi Becky, unfortunately you cannot directly create a custom object record in the manor you are describing (from a program or canvas step).  However, what you COULD do is submit to a form from program builder using the "Form Submit" cloud connector.  That way you can leverage the form processing steps as you would normally.  Be warned, if you want to use one custom object for ALL nurture records, then you will have to create a unique key other than email address (otherwise you will simply overwrite the last record over and over again).  The key could be something like email+nurtureName.  BUT be warned again, depending how many contacts you are nurturing, this type of cloud connector could get "clogged" pretty easily, as last i checked it was only able to process something like 300 records an hour.  If you have several thousand records potentially being nurtured, this may not be a great option.

  • Custom Objects details

    Hello,
    Does anyone have a clear and detailed overview from the Custom Objects? I know the general limitations of the new CO's like webservices and all, but if I am not mistaking there were or are also differences between CO3 and CO's 1 + 2, mainly with the relationships to other object types.
    Kind regards,
    Niels Rekers

    Bob,
    Thanks for the suggestion but I am not looking at the reporting functionalities of the Custom Objects at the moment. I am planning a couple of changes that will require the use of custom objects and change the current use of some custom objects as we cannot use the full functionality (e.g. teams, webservices, books, attachments) as we can with CO1 or CO2. So I would really need a complete overview with a level of detail that shows the relationships per CO to other objects for both webservices as is available in the system itself.
    I have also logged a Service Request for this, as my requirements should be known within Oracle, but that is already open for more than a month without a proper answer.
    Kind regards,
    Niels Rekers

  • Custom Objects - defaulting 'Name' to have relate list sort nicely :)

    I am attempting to use a custom object to store various information. I see that 'Name' is a required field. It also seems that it is the Name field which is used to sort the related list. Any suggestions on how to automatically populate the NAME field? I would relaly like it to be the same and another picklist field which is on the screen.
    Thanks.

    Problem is that 'Name' is a required field and post value will not work.
    If I set the 'Name' to a pre default, the value I want to use has not yet been selected by the user. The sorting on these related objects is messy.

  • Do custom objects work with email integration?

    I would like to consider using a custom object for a division of our organization to separately log support tickets (we've run out of available fields in the service request object). Is there any way to use the email integration with custom objects?
    Thanks
    Diana

    According to the Help, only the following records are supported: Account, Contact, Lead, Opportunity, or Service records. The custom record types that we have created do not show up in the Email integration either.

  • Error when querying custom object 5 using contact Id

    Hi,
    I have related custom object 5 to contacts in CRM On demand. I am trying to find out the custom object 5 records related to contact based on the contact Id. I'm using the query page function in the wsdl for custom object 5 (web services 2.0) and the SOAP UI tool.
    Here is the SOAP request (I replaced the contact id in the xml below ):
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="urn:crmondemand/ws/ecbs/customobject5/10/2004" xmlns:quer="urn:/crmondemand/xml/CustomObject5/Query">
    <soapenv:Header/>
    <soapenv:Body>
    <ns:CustomObject5QueryPage_Input>
    <quer:ListOfCustomObject5 pagesize="?" startrownum="?" recordcountneeded="?">
    <!--Optional:-->
    <quer:CustomObject5 searchspec="?">
    <!--Optional:-->
    <quer:ContactId sortorder="?" sortsequence="?"><+Id from CRM on demand+></quer:ContactId>
    </quer:CustomObject5>
    </quer:ListOfCustomObject5>
    </ns:CustomObject5QueryPage_Input>
    </soapenv:Body>
    </soapenv:Envelope>
    I get the following response:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Body>
    <SOAP-ENV:Fault>
    <faultcode>SOAP-ENV:Server</faultcode>
    <faultstring>Field 'Contact Id' in the integration component 'CustomObject5' instance contains invalid query expression: <Contact id that I entered in request>(SBL-EAI-13002)</faultstring>
    <detail>
    <siebelf:siebdetail xmlns:siebelf="http://www.siebel.com/ws/fault">
    <siebelf:logfilename>siebel.log</siebelf:logfilename>
    <siebelf:errorstack>
    <siebelf:error>
    <siebelf:errorcode>(SBL-EAI-13002)</siebelf:errorcode>
    <siebelf:errorsymbol/>
    <siebelf:errormsg>Field 'Contact Id' in the integration component 'CustomObject5' instance contains invalid query expression: <Contact id that I entered in request>(SBL-EAI-13002)</siebelf:errormsg>
    </siebelf:error>
    <siebelf:error>
    <siebelf:errorcode>(SBL-EAI-13006)</siebelf:errorcode>
    <siebelf:errorsymbol/>
    <siebelf:errormsg>Invalid operator: <Contact id that I entered in request>(SBL-EAI-13006)</siebelf:errormsg>
    </siebelf:error>
    </siebelf:errorstack>
    </siebelf:siebdetail>
    </detail>
    </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    Can anyone tell me what could be the problem? or what should be the format of the input parameter in the request? I checked in On demand and there should be 1 custom object 5 row returned in the response.

    Hi,
    Thanks a lot . I will try this method too. However, this is how I resolved the problem. I changed my soap request include a search based on contact id:
    <soapenv:Body>
    <cus:CustomObject5QueryPage_Input>
    <quer:ListOfCustomObject5>
    <!--Optional:-->
    <quer:CustomObject5 searchspec="[ContactId]='CRM On Demand Contact Id'">
    <!--You may enter the following 786 items in any order-->
    <quer:Id/>
    <quer:ContactId/>
    <quer:AccountId/>
    <quer:IndexedPick0 />
    </quer:CustomObject5>
    </quer:ListOfCustomObject5>
    </cus:CustomObject5QueryPage_Input>
    </soapenv:Body>
    What I din't realize was that the column names I specified in the quer: tag would be fetched from CRM and returned in the response.
    Regards,

  • Vectors: contains() inconsistency with Object equals()

    Hi,
    I have a problem with using Vector contains() on my own classes.
    I have a class TermDetails, on which I have overloaded the equals() method:
         public boolean equals(Object other) {
              try {
                   TermDetails otherTerm = (TermDetails) other;
                   return (term.equals(otherTerm.term));
              catch (Exception e) {
                   try {
                        String otherTermString = (String) other;
                        return (term.equals(otherTermString));
                   catch (Exception f) {
                        System.out.println("Can't convert Object to TermDetails or String");
                        System.out.println(f.getMessage());
                        return(false);
         public boolean equals(String otherTermString) {
              return(term.equals(otherTermString));
    The Vector.contains() should then use one of these equals methods to return correctly, but doesn't use either of them... any ideas why not?
    (I've tried adding some console output in the equals methods, just to prove if they get called or not. They don't.)
    Thanks in advance!
    Ed

    This won't work. It only tests whether the two objects are of the same class. In general, you need to test a number of things:
    1) if obj == this, return true
    2) if obj == null, return false
    3) if obj.getClass() != this.getClass() return false
    (Note: You don't need getClass().getName(). Also, there are times when the classes don't have to match, but it's sufficient that obj and this implement a particular interface--Map for instance).
    4) if all relevant corresponding fields of obj and this are equal, return true, else false.
    That's just a high level run-down, and you should definitely look at the book that schapel mentioned.
    Also, this probably won't affect Vector.contains, but make sure that when you override equals, you also override hashCode. The rule is that if a.equals(b) returns true, then a.hashCode() must return the same value as b.hashCode(). Basically any field that is used in computing hashCode must also be used in equals.
    Note that the converse is not true. That is two objects with the same hashCode don't have to be equal.
    For instance, if you've got a class that represents contact info, the hashCode could use only the phoneNumber field. hashCode will then be fast to compute, will probably have a good distribution (some distinct people's contact info could have the same phone number, but there won't be a large overlap), and then you use phone number plus the rest of the fields (address, etc.) for equals.
    Here's an example that shows that equals will work if
    written correctly
    import java.util.Vector;
    public class testEquals {
    public static void main(String args[]) {
    Vector testVector = new Vector();
    testVector.add(new A());
    testVector.add(new B());
    System.out.println("A == A? " +
    + testVector.contains(new A()));
    System.out.println("B == B? " +
    + testVector.contains(new B()));
    class A {
    public boolean equals(Object object) {
    if (getClass().getName() ==
    = object.getClass().getName()) {
    System.out.println("A == A");
    return true;
    } else {
    return false;
    class B {
    public boolean equals(Object object) {
    if (getClass().getName() ==
    = object.getClass().getName()) {
    System.out.println("B == B");
    return true;
    } else {
    return false;

Maybe you are looking for