Question: I have to custom data lists:

```
    public class DatType1
{

    public string yr;
    public string qr;
    public string mt;
    public string cw;
    public string tar;
    public string rg;
    public string mac;
    public string fuel;
    public double fp;
    public double fi;
    public double fd;

}

```

and

```
public class DatType2
{

    public string yr;
    public string qr;
    public string mt;
    public string cw;
    public string tar;
    public string RG;
    public double pp;
    public double pi;
    public double fp;
    public double fi;
    public double fd;

}

```

As you can see there is a lot of overlap between the two. I would like to add the values for DatType1.fp, DatType1.fi, DatType1.fd to DateType2 but I need to put them in the right place, the right place means where a bunch of the items are equal. 

I have looked a lot on the site here but couldnt figure it out. I have tried sth like this:

```
from a in TableA
from b in TableB
where a.yr==b.yr & a.qr==b.qr & a.RG == b.RG & a.tar ==b.tar
select( r=> new DatType2{....}

```

and then in the brackets repeat everything from DateType2 that I want to keep and add DatType1.fp, DatType1.fi, DatType1.fd.

If I did this with brute force I would do a double for loop and go through each line of DatType1 and see where I match a row in DatType2 and then add DatType1.fp, DatType1.fi, DatType1.fd - But this would be very slow

This however didnt work and is far from elegant! ...:) 
Any pointers would be much appreciated.

Thanks

Answer: 
The integers are stored in a generated file called `R.java` in the project's `gen` folder. A sample from a recent work-in-progress of mine is:

```
public final class R {
public static final class attr {
}
public static final class drawable {
    public static final int cot_logo=0x7f020000;
    public static final int cot_logo_small=0x7f020001;
    public static final int ic_launcher=0x7f020002;
    public static final int icon=0x7f020003;
}
public static final class id {
    public static final int password=0x7f060001;
    public static final int username=0x7f060000;
}
public static final class layout {
    public static final int login_dlg=0x7f030000;
    public static final int main=0x7f030001;
}
public static final class string {
    public static final int app_name=0x7f050000;
}
public static final class xml {
    public static final int config=0x7f040000;
}

```

}

As you can see, there is a pattern to how they are generated. Each category of resource is given its own area to work with.

Another thing to note is that they are generated in the order they are encountered in the XML/folders/etc. So, for example, if you move some views around in the XML, you'll need to clean your project to regenerate the full `R.java` file. Otherwise, the integer mappings will be incorrect and you'll end up with(most likely) a `ClassCastException`, or unexpected behaviour at the very least.
To understand how those numbers are generated you will need to find out how **aapt** works because that tool is responsible for generating the `R.java`. You can git clone the Android repository and check the aapt source code but It's quite complicated (at least for me).

If you want to see the code, First clone the source:

```
git clone "https://android.googlesource.com/platform/sdk"

```

Then navigate to `src/com/android/ide/eclipse/adt/internal/build`, This is where *aapt* related sources are.