}
final ServiceItem lhs = (ServiceItem) e1;
final ServiceItem rhs = (ServiceItem) e2;
final BundleItem lhsBundle = (BundleItem) lhs.getAdapter(BundleItem.class);
final BundleItem rhsBundle = (BundleItem) rhs.getAdapter(BundleItem.class);
if (lhsBundle == null && rhsBundle == null) {
return 0;
} else if (lhsBundle == null) {
return -1;
} else if (rhsBundle == null) {
return 1;
} else {
int value = lhsBundle.getSymbolicName().compareTo(rhsBundle.getSymbolicName());
if (value == 0) {
value = lhs.getServiceInterfaces()[0].compareTo(rhs.getServiceInterfaces()[0]);
}